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.


Messages - cefengxu

Pages: 1 2 [3] 4 5
31
at the end , i have to change the rotation of the model in blender firstly, and then the rendering result is correct......

Thanks

32
Support / Re: rotation matrix error [ JPCT-AE + ARToolkit + AR Application]
« on: November 03, 2015, 01:29:18 pm »
the code was shown below :

Matrix dump = new Matrix();
dump.setDump(ARNativeActivity.getTransformationM());
dump.transformToGL();
md2model.clearTranslation();
md2model.translate(dump.getTranslation());      //   the translation could be sure that it's right because the model can translate through the mark on the screen
md2model.clearRotation();
md2model.setRotationMatrix(dump);   // and then the model lied on the mark

33
Support / rotation matrix error [ JPCT-AE + ARToolkit + AR Application]
« on: November 03, 2015, 01:26:48 pm »

hi master:


for the issue " the model rendered by JPCT always lied on the mark and can not be rotate basic the matrix output from ARToolkit "

actually, the matrix output from the ARToolkit::ARNativeActivity.getTransformationMatrix() is correctly and the result of matrix  be such like this:

  0.9592849       0.042872142   -0.27916315   0.0
0.161977        -0.8932123         0.41944835    0.0
-0.23136866   -0.44758964      -0.86379063    0.0
-58.357327     38.013783            381.9324        1.0

<< Orange Color : the rotation info[/size]  [/size]Green  Color: the translation info>>

so i think i just set the translation and  rotation for the model and the result should be right. and then i set up to  jpct-matrix and set into the model like this:

Matrix dump = new Matrix();
dump.setDump(ARNativeActivity.getTransformationM());
dump.transformToGL();
                 
a.clearTranslation();
a.translate(dump.getTranslation());      //   the translation could be sure that it's right because the model can translate through the mark on the screen
                 
a.clearRotation();

a.setRotationMatrix(dump);   // and then the model lied on the mark


dump.rotateX/Y/Z((float)Math.PI/2);    i try to use matrix rotation to rotate the model before process  a.setRotationMatrix(dump) , but no work , the model some time will missing

so , i think i can not handle it now , i have spend server day to deal with this issue but no work.

34
matrix.setRow(3,0f,0f,0f,0f); this is the same and no use, because the function: a.setRotationMatrix(dump);
just using the  3*3 matrix in dump to process the rotation.

35
actually, the matrix output from the ARToolkit::ARNativeActivity.getTransformationMatrix() is correct and the result of matrix  be such like this:

Orange Color : the rotation info  Green  Color: the translation info

  0.9592849       0.042872142   -0.27916315    0.0
  0.161977        -0.8932123         0.41944835    0.0
-0.23136866   -0.44758964      -0.86379063    0.0
-58.357327     38.013783            381.9324        1.0


so i think i just set the translation and  rotation for the model and the result should be right. and then i set up to  jpct-matrix and set into the model like this:

Matrix dump = new Matrix();
dump.setDump(ARNativeActivity.getTransformationM());
dump.transformToGL();
                 
a.clearTranslation();
a.translate(dump.getTranslation());      //   the translation could be sure that it's right because the model can translate through the mark on the screen
                 
a.clearRotation();


a.setRotationMatrix(dump);   // and then the model lied on the mark


dump.rotateX/Y/Z((float)Math.PI/2);    i try to use matrix rotation to rotate the model before process  a.setRotationMatrix(dump) , but no work , the model some time will missing

36
yes , it  seems be call from Bones / SkeletonDebugger.java

Code: [Select]
private static Object3D createPyramide(SimpleVector from, SimpleVector to, float scale) {
    p.setRotationPivot(SimpleVector.ORIGIN);
}

37
have tried , and then the model was missing~~~

38
i used the jpct-ae to load a md2 model but the result is the same( the model still lied on the mark  but the position is right).

i think it should be caused by the camera up / direction , but i not sure, i cann't handle this~~~~~~~~~

may be i have to will try again later , thanks

39
Bones / [ resolved]rendering a model on correct mark position in ARToolkit
« on: November 02, 2015, 10:09:34 am »
Hi raft :

the model can be rendering according to you support .

However , the model can not be rendered in correct position ( the rotation is no right , as shown as attached)

case 1 : using the function : model.rotateXYZ(float r) : result : the model could no be in correct angle , some time the model  even missing ;
case 2 : the matrix output from ARToolkit is correct Definitely , because i have verified via rendering a cube through OpenGL ES ;
case 3 : such bug still exists in JPCT-AE;

but i still do not know how to do. so  do you have some idea about it ?

the code was shown as belown:

Code: [Select]
public void onDrawFrame(GL10 unused) {
//...
Matrix projMatrix = new Matrix();
projMatrix.setDump(ARNativeActivity.getProjectM());
projMatrix.transformToGL();
SimpleVector translation = projMatrix.getTranslation();
SimpleVector dir = projMatrix.getZAxis();
SimpleVector up = projMatrix.getYAxis();
cameraController.setPosition(translation);
cameraController.setOrientation(dir, up);
//...
for (Animated3D a : group) {
a.animate(index, animation);
Matrix dump = new Matrix();
dump.setDump(ARNativeActivity.getTransformationM());
dump.transformToGL();
a.clearTranslation();
a.translate(dump.getTranslation());
a.setRotationMatrix(dump);
Log.i("jpct_test", "runing in loop 2");
}
//...
world.renderScene(frameBuffer);
world.draw(frameBuffer);
frameBuffer.display();
}

40
Purpose:
rendering a animating model via JPCT-Bones basic on ARToolkit Porject for Augmented Reality Application.


According  for the demo you support(Bones-Android-Ninja) , I have injected the code another project about ARToolkit and the model can be rendered on the screen in front of preview data ,  as shown on fig1.


Question:
If I  want to render  the model witch stand on the mark in real-time, how to change the camera position , camera direction and the model position/rotation.

Actually, I can realize it with md2 model using JPCE-AE ( as shown in figure2 , the code was shown as bellow) : But , for JPCT-Bones, how to do ?

Code: [Select]
[size=12pt]public void onDrawFrame(GL10 unused) {
float[] projection = ARNativeActivity.getProjectM();

Matrix projMatrix = new Matrix();
projMatrix.setDump(projection);
projMatrix.transformToGL();
SimpleVector translation = projMatrix.getTranslation();
SimpleVector dir = projMatrix.getZAxis();
SimpleVector up = projMatrix.getYAxis();
cam.setPosition(translation);
cam.setOrientation(dir, up);

float[] transformation = ARNativeActivity.getTransformationM();

Matrix dump = new Matrix();
dump.setDump(transformation);
dump.transformToGL();
cube.clearTranslation();
cube.translate(dump.getTranslation());
cube.setRotationMatrix(dump);

cube.setState(stat);
cube.animate(ticks);

world.renderScene(fb);
world.draw(fb);
fb.display();
}[/size]



41
Bones / Re: [resovled] some error when inject the Bones
« on: October 30, 2015, 06:39:51 am »
how to deal with this issue as follown:

  • copy raft.jpct.bones & raft.jpct.bones.util into your project;
  • copy all jar from Bones into your project ( deleting the jpct-1.26.jar because it will conflict with the original one  );
  • copy script from Bones into your project ;

42
Bones / Re: some error when inject the Bones
« on: October 30, 2015, 03:28:17 am »
this problem was shown again , everythings was tried but could not deal with it

43
Bones / [resovled] some error when inject the Bones
« on: October 30, 2015, 03:19:38 am »
Hi raft :

i got some error when inject the Bones Project into my Project but some error was shown as below:

10-30 10:07:47.388: E/AndroidRuntime(8944): FATAL EXCEPTION: GLThread 887
10-30 10:07:47.388: E/AndroidRuntime(8944): Process: com.airhockey.android, PID: 8944
10-30 10:07:47.388: E/AndroidRuntime(8944): java.lang.NoClassDefFoundError: Failed resolution of: Lraft/jpct/bones/BonesIO;
10-30 10:07:47.388: E/AndroidRuntime(8944):    at com.airhockey.android.AirHockeyRenderer.onSurfaceCreated(AirHockeyRenderer.java:133)
10-30 10:07:47.388: E/AndroidRuntime(8944):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1500)
10-30 10:07:47.388: E/AndroidRuntime(8944):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)

i think it should be the Problem  of Import , but  i have set the Java Build Project to Bones already, so what't i need to do ??

44
according to the links  supplied from you , i can inject the code of JPCT-AE into the ARToolkit's Project [ Example name : ARNative ].

JPCT-AE  using the Matrix( "Projection Matrix" and "Transformation Matrix"  ) which output from ARToolkit  to render a model on the mark successfully. the center , scale of model can match the mark in every case ( as the attached shown ), but , the model alway lie in the mark. .

I have tried to use the Matrix.rotateX/Y/Z( float x ) to rotate the model but still no work .( the model still lie in the mark )

Code: [Select]
public void onDrawFrame(GL10 unused) {
  float[] projection_temp = ARNativeActivity.getProjectM();

  Matrix temp1 = new Matrix();
  temp1.setDump(projection_temp);
  [color=green]temp1.rotateY((float)Math.PI/2);              // the rotate have to be  used for diff. matrix [  "Projection Matrix" and "Transformation Matrix"    ]  as the same time , otherwise, the model   will miss[/color]
  float[] projection = temp1.getDump();

  Matrix projMatrix = new Matrix();
  projMatrix.setDump(projection);
  projMatrix.transformToGL();
  SimpleVector translation = projMatrix.getTranslation();
  SimpleVector dir = projMatrix.getZAxis();
  SimpleVector up = projMatrix.getYAxis();
  cam.setPosition(translation);
  cam.setOrientation(dir, up);

  float[] transformation_temp = ARNativeActivity.getTransformationM();

  Matrix temp2 = new Matrix();
  temp2.setDump(transformation_temp);
  [color=green]temp2.rotateY((float)Math.PI/2);      // the rotate have to be  used for diff. matrix [  "Projection Matrix" and "Transformation Matrix"    ]  as the same time , otherwise, the model will miss[/color]
  float[] transformation = temp2.getDump();

  Matrix dump = new Matrix();
  dump.setDump(transformation);
  dump.transformToGL();
  alita.clearTranslation();
  alita.translate(dump.getTranslation());
  alita.setRotationMatrix(dump);

  alita.setState(stat);
  alita.animate(ticks);

  world.renderScene(fb);
  world.draw(fb);
  fb.display();
}


45
Support / Re: Serious Help Needed[AR]
« on: October 27, 2015, 05:40:48 pm »
I just a nobody for JPCT , so may be we just can learn from each other.

BTW, EgonOlsen should be the master of JPCT !!  He is your choose~

Pages: 1 2 [3] 4 5