PDA

View Full Version : View Box Coords?



nickels
02-22-2000, 01:35 PM
I am doing some view box culling. These are my steps:

-setup PROJECTION matrix
-setup MODELVIEW matrix

-get projection & modelview matrices from opengl. Multiply.

-Project the coords of the bounding box using this matrix.

-Test whether the projected point will be mapped to the screen or not. (*)

Opengl will take this coord and map it into window coords.

My question is:
What coords at * should I test for. It appears -1 < x < 1 and -1<y<1 are correct. What about the z coord?
What projected coords are mapped into the viewport?
Does this depend on the projection? (I really dont think it does).

Thanks.

Mad Max
02-23-2000, 08:21 AM
Are you exectly "project" or "rotate and translate" yours box by multiply it on Projection-ModelView Matrix. If you project yours box, than you lose z-coordinate. May be you should try not plane clipping (test x and y coords of projected object), try volume clipping - test x, y and z coords of object, after rotation and translation, in yours view frustum.

Yours, Mad Max.

[This message has been edited by Mad Max (edited 02-23-2000).]

nickels
02-28-2000, 03:05 PM
The only z case that I care about is if a whole ton of triangles are behind me. Then they will pass the x y tests, but I don't want to send all the verticies through the pipeline. I want to zap them dead from the start. Does not the projection matrix keep the z for depth buffering? I thought the z coord was projection into 0-1 space with relative distances maintained? I guess I need to sit down and start projecting things back and forth and analyze the results.