Home Products Download Order Contacts


Subject: Camera lost in projection matrix. With me.

Hello everybody.

I am working on an export of a 3D scene. The scene itself is exported
properly, but the camera export is not perfect.

The format of the file requires (only) one transformation matrix for
the camera. So I had to combine the projection matrix and the viewing
transformation matrix into only one matrix. The algorithm is the

- using fovy, znear, zfar and aspect-ratio I am computing a perspective
projection matrix P;

- using the center of projection, the view reference point and the view
up vector I generate a transformation matrix M;

- the result is P x Inverse(M).

The export is ok if the objects (on the screen) are in the middle of
the current view, the camera is exported properly. However if I move
the objects in some corner of the view, the export is totally wrong,
the orientation of the camera is strange - I have the objects behind,
or on the side, partially visible.

I don't suspect the second algorithm (for matrix M), it is used in our
software during rendering and it seems to work. But from the behaviour
of the export (somehow the viewing direction is lost, the distance
camera-scene seems to be ok) I don't know what could possibly be the

I don't know so much OpenGL, but studying the existing code (and some
documentation) I thought that point vectors are first multiplied by the
viewing matrix - or matrix stack - calculated by gluLookAt and then
multiplied by the projection matrix (stack), so the order P x
Inverse(M) seems "unnatural"..

Does anybody have a suggestion ?

Thank you for your time.


View All Messages in comp.graphics.algorithms


Re: Camera lost in projection matrix. With me.

Copyright 2006 WatermarkFactory.com. All Rights Reserved.