Author Topic: Integrating JPCT-AE with Vuforia - Rotation of modelViewMatrix  (Read 3378 times)

Offline mxar

  • int
  • **
  • Posts: 78
    • View Profile
Integrating JPCT-AE with Vuforia - Rotation of modelViewMatrix
« on: September 23, 2015, 11:37:11 pm »

Hi,

In JPCT-AE  - Vuforia integration procces, the modelview matrix created by Qualcomm's Vuforia engine is rotated 180 degrees around X axis before sending it to jPCT-AE, due to jPCT's coordinate system.

My question is if rotating the modelview matrix will have the result of displaying the 3D Objects upside down.

Also, is it possible JPCT-AE to have the same coordinate system as OpenGL? any special version of JPCT-AE perhaps? or configuration?

Thanks in Advance





Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Integrating JPCT-AE with Vuforia - Rotation of modelViewMatrix
« Reply #1 on: September 23, 2015, 11:52:16 pm »
It shouldn't. Vuforia and jPCT-AE use different spaces, the rotation of the model view matrix transforms it from one into the other. That should actually make the objects appear correct in jPCT and not upside-down.

About making jPCT use the same matrices as OpenGL: No, this won't happen, there's too much that I would have to change for that. It's not just the coordinate system, it's also that OpenGL's matrices are column-major while jPCT's are row-major and adapting for that would change calculation orders all over the place as well. The reasons for this are a) historical and technical ones (for the coordinate system) and b) cultural ones (for the row vs column thing). Or, very briefly: What OpenGL does sucks IMHO.

Offline mxar

  • int
  • **
  • Posts: 78
    • View Profile
Re: Integrating JPCT-AE with Vuforia - Rotation of modelViewMatrix
« Reply #2 on: September 24, 2015, 08:55:20 am »

Ok, thanks, I understand you.

Also, I have to check my source code about the incorrect appearance of 3d objects.

Also i have another question.The rotated modelview matrix passed from Qualco engine to JPCT-AE is actually the modelview matrix of the marker.

When I insert a 3d object, this has a different modelview matrix?

When i rotate a 3d object calling the Object3D.rotateX() method (or rotateY(),rotateZ()) I noticed that when i move the marker or the camera, the rotated object3D is not actually in the same position, it moves slightly.

The same issue i have when i scale the object3d.

How can i solve this issue? I have to use a difference approach to rotate or scale the object3d?

Thanks in advance


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Integrating JPCT-AE with Vuforia - Rotation of modelViewMatrix
« Reply #3 on: September 25, 2015, 12:24:10 pm »
Have you had a look at the wiki page about Vuforia? Doesn't it cover this step somehow? The model view matrix is nothing that you can just set into an Object3D. It's not the start of a transformation, it's the end. It's the result of everything that transforms an object from object into camare space.

Offline mxar

  • int
  • **
  • Posts: 78
    • View Profile
Re: Integrating JPCT-AE with Vuforia - Rotation of modelViewMatrix
« Reply #4 on: September 25, 2015, 02:41:37 pm »

Hi,

you mean the http://www.jpct.net/wiki/index.php?title=Integrating_JPCT-AE_with_Vuforia ?

I have followed the directions of this tutorial, it is very helpfull.

Actually I use the java version of detecting a marker instead of C++.

I agree with the "the model view matrix is nothing that you can just set into an Object3D. ... it's the end of transformation."

Well, I check my code deeply.

Thanks for your time.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Integrating JPCT-AE with Vuforia - Rotation of modelViewMatrix
« Reply #5 on: September 25, 2015, 02:46:52 pm »
It would be cool, if you could add something about the java version to wiki once you get it working as intended.

Offline mxar

  • int
  • **
  • Posts: 78
    • View Profile
Re: Integrating JPCT-AE with Vuforia - Rotation of modelViewMatrix
« Reply #6 on: September 25, 2015, 02:57:14 pm »
ok