www.jpct.net
jPCTAE  a 3d engine for Android => Support => Topic started by: mxar on October 08, 2015, 11:27:58 am

Hi,
I have an issue with the jPCTAE coordinate system.
In my application the Object3Ds are positioned from an application using the Opengl coordinate system.
How can i convert the opengl coordinate system to jPCTAE coordinate system?
For example , when the third party application calls the Object3D.translate(float x, float y, float z) method then what steps i have to follow
to do the conversion?
Thanks in advance

In case of a translation, you can simply invert y and z.

Thanks for the quick answer.
This solution I have to apply for camera position and direction?
I mean all the position , rotation ( any similar methods ) can use this solution?
Thanks in advance

You can't invert z and y on a rotation, so...the right way of doing it is to rotate PI around X. Inverting z and y is just a shortcut for translations.

Thanks
but I think , (because it is an Augmented Reality project) ,if rotating the Camera's object Model View matrix 180 degrees around X axis
will be a good solution. (Like the one integrating Vuforia with jPCTAE).
In this case no Y,Z inverting needed, or rotating PI around X.
Am I right?
So there are 2 solutions:
1) Just rotate 180 degrees around X axis the modelview matrix applied to Camera object.
2) Dont to any changes to camera. Just Invert Y and Z and in case of rotating PI around X in case of rotation.
Thanks in Advance.

Whatever you do, you have to make sure that the world that you render is the world how jPCTAE sees it. Modifying the matrix in the last stage isn't a good idea, because it will screw up culling and such.

Thanks but in case of integrating jPCTAE with Vuforia ,the solution of rotating 180 degrees around X axis will screw up culling and such?
Thanks in Advance

No, the solution with just tweaking the model view matrix in the shader will. Or maybe I didn't get your point...

My Application is an Augmented 3D application.
But the part of inserting 3d objects in the renderer's world is not created by me.Unfortunately this part uses the opengl coordinate system.
So reading the jPCTAE integration with Vuforia tutorial i had in my mind that rotating the marker's modelview matrix (returned by the AR engine) 180 degrees around X axis to set camera position and direction will be finally a good solution .
Am I right?
Thanks for your time

Sounds fine to me the then. Just keep in mind that matrices in jPCT are row major, while OpenGL's matrices are column major. Depending on your actual code, you might have to use Matrix.transformToGL() to convert between both formats. But the Wiki tutorial should actually cover this in some way.

Ok
thank you

Hi again.
I need some clarificaion on loading Object3Ds.
I noticed that when i add to the world an Object3D ( .obj,.3ds ,...) then in rendering the Object3D is displayed upside down.
So I have to call the Object3D.rotateX(Math.PI) method.
This is something expected?
This is because of the jPCT's coordinate system?
Thanks in advance

Depends on the model and the exporter. Sometimes you don't have to do anything, sometimes a rotateX(Math.PI), sometimes a rotateX(Math.PI/2f)...it depends. So yes, this is to be expected.

Thanks for your answer.
But generally, is there any specific rule when we have to do the rotation?
Thanks in Advance

None that I know of. A rotateX(Math.PI) is needed in most cases, but not in all.