Vuforia Rotation Matrix to jPCT Rotation Matrix

Started by Shizzn, August 27, 2013, 12:10:21 PM

Previous topic - Next topic

Shizzn

Hallo and howdy,

I successfully integrated Vuforia into my jPCT-AE project and instead of changing the camera Position I change the position of the 3D-Objects in relation to the camera.
Therefore I use the pose matrix of the Vuforia SDK which is a 3x4 matrix:
poseMatrix = [R|t]
R is the 3x3 rotation matrix
t is the 1x3 translation matrix

I track several markers and put one 3D-Object 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 jPCT-Thread.
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 3D-Objects 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

EgonOlsen

Isn't this covered by

Quote
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 jPCT-AE.

in http://www.jpct.net/wiki/index.php/Integrating_JPCT-AE_with_Vuforia?

Shizzn

#2
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.

EgonOlsen

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... ???

Shizzn

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 JPCT-AE 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

EgonOlsen

Quote from: Shizzn on August 27, 2013, 01:34:46 PM
I think the 'Integrating JPCT-AE 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!