www.jpct.net
jPCTAE  a 3d engine for Android => Support => Topic started by: Shizzn on August 27, 2013, 12:10:21 pm

Hallo and howdy,
I successfully integrated Vuforia into my jPCTAE project and instead of changing the camera Position I change the position of the 3DObjects in relation to the camera.
Therefore I use the pose matrix of the Vuforia SDK which is a 3x4 matrix:
poseMatrix = [Rt]
R is the 3x3 rotation matrix
t is the 1x3 translation matrix
I track several markers and put one 3DObject on each of them. To set the position of the marker I use the translation matrix. This works like a charm.
But I have problems setting the rotation of the objects. I use the setRotationMatrix method of the Object3D class.
Therefore I first hardcode my Vuforia 3x3 rotation matrix in a 4x4 jPCT rotation matrix like described in this jPCTThread (http://www.jpct.net/forum2/index.php/topic,830).
This works. But the coordinate system of jPCT is rotated 180 degrees around the x axis with respect to Vuforia's coordinate system.
That's why the 3DObjects just rotate in the wrong direction. With transposing Vuforia's 3x3 rotation matrix I get the right rotation but the objects seem to be behind the marker. This is pretty ugly.
I could just move the objects in front of the marker but this is not the way I want to solve this problem, because I have several (probably) different sized objects.
My Question: Can Vuforia's rotation matrix be changed (rotated) to a jPCT's rotation matrix with respect to their different coordination systems?
Greetings
Shizzn

Isn't this covered by
Note the rotation that we apply to the modelViewMatrix. This is due to jPCT's coordinate system being rotated 180 degrees around the X axis with respect to Vuforia's. What we do here is perform that rotation to the matrix before sending it to jPCTAE.
in http://www.jpct.net/wiki/index.php/Integrating_JPCTAE_with_Vuforia (http://www.jpct.net/wiki/index.php/Integrating_JPCTAE_with_Vuforia)?

The problem is that this wiki page only covers positioning the camera and not the objects.
That's why there is only used the 4x4 modelviewmatrix, which somehow describes the position of the camera to each tracked marker. WRONG
But I use the pose matrix (because it contains the rotations and translation of each tracked marker in respect to the camera).
The vuforia rotation matrix just needs to be adjusted. That's why I'm wondering if there is a method in jPCT or matrix operation which can apply an rotation to an rotation matrix.

Of course. You can apply any kind of rotation to an instance of Matrix. Just look at the docs for Matrix. I'm still not sure, that this is really what you are asking for here... ???

Okay, thanks for your help.
Now, I know that Vuforia's 4x4 model view matrix does contain the rotation and position of the tracked marker. And the 180 degrees rotation of this matrix (described on the wiki page) is equivalent to transposing the rotation matrix, because the 'object behind marker'effekt is the same as mine.
I guess I'll handle the objects' rotation and position with the modelview matrix, altough I'll have to adjust the objects' heights.
I think the 'Integrating JPCTAE with Vuforia' Wiki page is a good start, but should have some background information on certain things. (e.g. content of the matrices or how to position objects)
If I make progress with my Android Application, I'll post some screenshots in a new thread;)
Thanks, again.
Viele Grüße
Shizzn

I think the 'Integrating JPCTAE with Vuforia' Wiki page is a good start, but should have some background information on certain things. (e.g. content of the matrices or how to position objects)
I will be very happy if somebody (like yourself... ;) ) takes the time to update the wiki page. I haven't written it and i've never used Vuforia myself, so i'm not the person to do it. If you want to contribute, i can create a wiki account for you. Just let me know!