OpenGL and POV Camera

Hello all,

I am trying to render 3D heightfields using POV. Currently I am using OpenGL to do the display, but would like the option of POV support.

The only issue is getting the same “view angle” for the POV output.

The camera in POV is defined by location, direction, right and look_at parameters (all in X,Y,Z format).

So how do I convert OpenGL settings for Eye, Center, Up, FOV and Rotation into POV compliant Camera settings?

I am not a math guru, so some formulas would be excellent (if anyone understands what I am asking).

POV in this message means the POV-RAY Raytracer from www.povray.org.

Best regards,
TallGuy.

[This message has been edited by TallGuy (edited 04-10-2001).]

Well, first of all, POV-RAY must have some settings for field-of-view and other gluPerspective variables. It needs them just as OpenGL does. So you should investigate where those are.

Secondly, the ones you mention are pretty simple. POV’s ‘location’ is the OpenGL ‘Eye’ point (I’m sure you’re shocked by this). OpenGL’s gluLookAt prefers an ‘Up’ vector to a ‘right’ vector. To handle this (assuming both are in a right-handed coordinate system), just take the cross-product between the OpenGL ‘up’ vector and the forward direction. Negate this answer (since it return ‘left’ instead of ‘right’).

As for POV’s ‘direction’ and ‘look_at’, one of those is the same as the gluLookAt ‘Center’. gluLookAt expects a world-space point to center on screen for ‘center’. POV’s ‘look_at’ sounds like this, but the POV-RAY documentation should be able to clarify. If you do still need ‘direction’, presumably that is the direction you want the camera to look. That means it is the direction from the ‘Eye’ point to the ‘Center’ point.

Thanks Korval. Things are beginning to make more sense now. OpenGL center is the same as the POV look_at.

So I can now get the camera positioned at the OpenGL eye coordinates and get it to look at the OpenGL center point.

Using the OpenGL Rotation angles gives a slightly different angled display in POV.

The FOV settings in OpenGL are equivalent to the Camera angle in POV. Once again a slightly different angle result in POV, but more than acceptable for the time being.

Thanks again for the quick reply.

TallGuy.

[This message has been edited by TallGuy (edited 04-10-2001).]

[This message has been edited by TallGuy (edited 04-10-2001).]