PDA

View Full Version : meaning of z component of projection matrix



mauro
03-28-2005, 05:33 AM
Hi,

The projection matrices in openGL are of size 4x4.

But what is the meaning of the z component, as normaly a projection matrix is of size 3x4? (projecting from 3D to 2D)

Is it the distance from your vertex to the camera plane, or is it meaningless, or ... ?

thank you,
BERT

zeckensack
03-28-2005, 05:50 AM
It doesn't project straight to 2D. That would be an awful limitation.
With a three-row matrix you can only do W buffering (or no depth buffering at all, obviously). Note that W is required for perspective correction anyway. You can't support textures in any sensible way without it.

But OpenGL uses Z/W for depth buffering, so its matrices need to have four rows to produce X,Y,Z,W.

M/\dm/\n
03-28-2005, 08:42 AM
It just projects to unit cube so that depth component remains in range [-1;1] (if I'm not mistaken with DX)