Converting handedness

Hello all,

I am still working with trying to convert OpenGL patches into POV-Ray compatible raytracings.

Everything works now except the rotation angles.

In OpenGL you have X going right, Y going up and Z coming out of the screen. In POV-Ray x and y are the same, but the Z axis goes into the screen for positive values.

Does anyone have any ideas on correctly converting the OpenGL X,Y,Z rotations into POV-Ray X,Y,Z rotations?


Are you sure that you’re right about this? I’m not a POV-Ray user, but…

If the only thing that’s different is that +z goes INTO the screen (right is still +x and up is still +y), then POV-Ray is using a left handed coordinate system, which is unusual.

If that is the only difference, you should be getting an exact mirror image of your opengl scene. Is this the case?

Let me know then I’ll try to help answer your question. I want to be sure this is a parity transformation and not simply a rotation.

– Zeno

I grew up on POV-ray back in the 2.x days, and I’m pretty sure it is left-handed. Drove me into a tizzy when I first started picking up OpenGL, as I couldn’t find any tutorial which would say such basic things as “OpenGL is right-handed” and “texture coordinates count from the bottom up”…

The “easy fix” to convert is to either swap two matrix rows (Y and Z are popular choices) or to just negate all the Z values. But, as you say, that means you gotta break out the Big Calculus Book when you get to rotations.

Another way to do it is to just set the final projection matrix to do the swapping for you. In POV-ray, that would be done with the “camera” clause; something like “camera { right -x }”; although I vaguely remember some warnings in the documentation about there being problems if you went crazy with the camera.

Anyway, I still pull out POV-ray when I need some quick textures or a skybox, so I’m glad there’s other people still having fun with it. Make sure you post here when you’re done!