Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - cefengxu

#1
News / Re: Version 1.30 has been released!
March 23, 2016, 07:15:35 AM
Cool ~
If some  APIs of Particles  could be added, it will be more better~
#2
i think , just i think,  may be your model is too complex  to be covered by the bones.
you can use the 3ds max to observe whether the shin of model envelops the bones  exactly.

or you can change the platform to using 3ds max. :)
#3
Support / Re: [ resolved ] picking of Object3D
December 14, 2015, 08:03:30 AM
thanks~!
#4
Support / Re: [ resolving ] picking of Object3D
December 14, 2015, 08:03:09 AM
cool ~ got it !
Have to delete Title Bar completely and show the OpenGL Render View only.
#5
Dear AGP:

i think may be you can try the tutorial as follow to export the Skeleton Model which can be rendered by Bones:

http://www.jpct.net/wiki/index.php?title=Tutorial:_Creating_models_in_3dsMAX_and_Render_via_jPCT-Bones
#6
Support / Re: [ resolving ] picking of Object3D
December 11, 2015, 10:06:13 AM
hi master:

i have spent lots of time to try it but got some strange result.
the faces of cube just valid at some part , as the attached shown.
my test code is every simple , i think it's  correct absolutely:

@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {       

        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);


}

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {

glViewport(0, 0, width, height);

fb = new FrameBuffer( width, height); // OpenGL ES 1.x constructor

world = new World();

sun = new Light(world);
sun.setIntensity(200, 20, 200);


loadOBJ("cube.obj" , "cube.mtl" , "cube_triangle.png");

cubeColor.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);


world.addObject(cubeColor);


cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 50);
cam.lookAt(cubeColor.getTransformedCenter());


sv.set(cubeColor.getTransformedCenter());
sv.y -= 100;
sv.z -= 100;
sun.setPosition(sv);

MemoryHelper.compact();

}

@Override
public void onDrawFrame(GL10 gl) {

        glClear(GL_COLOR_BUFFER_BIT);
       
if (touchTurn != 0) {
cubeColor.rotateY(touchTurn);
touchTurn = 0;
}

if (touchTurnUp != 0) {
cubeColor.rotateX(touchTurnUp);
touchTurnUp = 0;
}
       
if (actionEventDown_x != -1) {
SimpleVector dir= Interact2D.reproject2D3DWS(cam, fb, (int)actionEventDown_x, (int)actionEventDown_y).normalize();
Object[] res    = world.calcMinDistanceAndObject3D(cam.getPosition(), dir, 10000 /*or whatever*/);
actionEventDown_x = -1;
actionEventDown_y = -1;
if(res[1] != null){
Log.i("jPCT_Picking", "res[0]="+res[0]+" , res[1]="+res[1]);

}
}

fb.clear(back);
world.renderScene(fb);
world.draw(fb);

fb.display();

if (System.currentTimeMillis() - time >= 1000) {
Logger.log(fps + "fps");
fps = 0;
time = System.currentTimeMillis();
}
fps++;

}
   
private InputStream mod = null;
private InputStream mtl = null;
private Object3D cubeColor = null;
private Object3D[] other = null;


public void loadOBJ(String strObjFileName, String strMtlFileName , String strTexFileName) {

try {
mod = this.context.getAssets().open(strObjFileName);
    mtl = this.context.getAssets().open(strMtlFileName);
TextureManager.getInstance().addTexture(strTexFileName, new Texture(context.getAssets().open(strTexFileName)));
} catch (Exception e) {
e.printStackTrace();
}
other = Loader.loadOBJ(mod, mtl,10.0f);
cubeColor = other[0];

}
#7
thanks you ,but seem not so convenient ~~  it work . thanks again raft
#8
Bones / [resolved] changing animation via interaction
December 10, 2015, 10:11:00 AM
hi raft :

i want to implement a feature .
when i touch the object with loop animation-1 , the object must have some respond ( do  another animation-2 ) , and then come back to the original animation-1 after the animation-2 is finished.

how to do that ? i know how to change the animation with model using :
group.animateSkin(index, animationID);

but i do not know how to handle the time of the animation, or does Bones have some simple ways to deal with it ??
#9
Support / Re: [ resolving ] picking of Object3D
December 04, 2015, 10:13:56 AM
thanks man , even i still can not solve it . i will try again in these day.  :'(
#10
Support / [ resolved ] picking of Object3D
December 02, 2015, 10:36:00 AM
Hi master :

i want to know the model do some reply when i touch it on the screen, so i use the Picking of jpct-ae  to realized it.
example
i add a cube with six diff. faces  and add setCollisionMode respectively :

     // Front
        front = new Object3D(2); 
        front.addTriangle(upperLeftFront,0,0, lowerLeftFront,0,1, upperRightFront,1,0, TextureManager.getInstance().getTextureID("frontt")); 
        front.addTriangle(upperRightFront,1,0, lowerLeftFront,0,1, lowerRightFront,1,1,TextureManager.getInstance().getTextureID("frontt")); 
        cube.addChild(front); 
        world.addObject(front);     
        front.setCollisionMode( Object3D.COLLISION_CHECK_SELF); 
         
     // Back...
 
     // Upper...
       
     // Lower...

     // Left...
         
     // Right ...

        cube.strip(); 
        cube.build(); 
        world.addObject(cube); 
        cube.setCulling(false); 
        cube.scale( 0.05f);     
        cube.setCollisionMode( Object3D.COLLISION_CHECK_SELF);


and then , i use the touch event to know which face was triggered when i touched the screen :

public int Pickint( int fX, int fY){ 
     
        //fY = fb.getHeight() - fY;
SimpleVector dir = Interact2D.reproject2D3DWS( cam, fb, fX, fY).normalize();
Object[] res=world.calcMinDistanceAndObject3D(cam.getPosition(), dir, 10000 );
         
        Object3D picked = (Object3D)res[1];   
         
        Object3D picked = (Object3D)res[1]; 
   
        if( picked == null){
       
            return -1; 
       }
       
       
        if( picked.getID() == front.getID()) 
        Log.i("jpctae", "touch front");
        else  if( picked.getID() == back.getID()) 
        Log.i("jpctae", "touch back"); 
        else  if( picked.getID() == upper.getID()) 
        Log.i("jpctae", "touch upper"); 
        else  if( picked.getID() == lower.getID()) 
        Log.i("jpctae", "touch lower");   
        else  if( picked.getID() == left.getID()) 
        Log.i("jpctae", "touch left");   
        else  if( picked.getID() == right.getID()) 
        Log.i("jpctae", "touch right");
         
        return 1; 
    }


However, the questions is :
1- the picked.getID() output only have some respond when i touch the top left corner of every face of cube.
2- or some time the picked always = null
#11
i know what's going on~ because the model is too complicated and too many vertexs.
so i used meshlab to reduce the vertexs and then the Bones can render it ~!

thanks ~
#12
hi  raft :

now i can create some simple model ( teapot , cube and et al ..  ), add some bones and animated  and export to .bones , and then render via bones successfully.

however, when i render some complex model ( or download from the internet  ), the result is : the screen shows nothing.
oppositely , i can export this model into obj and render via jPCT-AE successfully.

i am sure the "Steps of .Bones Export" is correctly and the code is ran  certainly according the logcat


so , do you meet such bug ??? or may be the Bones could no render some complex model with animation ?

Rgs

Cefengxu
#13
i have checked again my code and the FOV Value have been set according the wiki example definitely :

where:
   preview_size_x = 640; ( my preview size )
   preview_size_y = 480; ( my preview size )
   camera_params_focalLength_x = 678.29;
   camera_params_focalLength_y = 637.77;
so:
   float fovRadians  = 2 * atan(0.5f * 640/ 678.29) = 0.882627f ;
   float fovyRadians = 2 * atan(0.5f * 480/ 637.77) = 0.719839f ;

and then,  i added the code here ( i think that is correctly):

public void onSurfaceChanged(GL10 unused, int width, int height) {
    ........
     cameraController.setFOV(0.882627f);
     cameraController.setYFOV(0.719839f);
    .......
}

or here

public void onDrawFrame(GL10 unused) {
    ........
     cameraController.setFOV(0.882627f);
     cameraController.setYFOV(0.719839f);
    ........
}

#14
Actually, I have calculated the FOV Value through the Camera Params and set via : 
  cam.setFOV(xxx.f);   
  cam.setYFOV(xxx.f);

so, the model can be move and stand at right position( on the middle of mark ) when i move the camera.
#15
hi master:

i have import the obj via JPCT basic on ARTookit, however, the model has a peculiar distortion between two differnet model(landscape & portrait) , such like the cut picture shown.

i have refered the artical " Integrating JPCT-AE with Vuforia - Additional corrections " ,
but it seem not a reason to cause such distortion.

do you have another idea ?

Thanks..