Search code examples
graphicsmatrix3dprojectionfrustum

z-value of a projected 3d point


After a 3d point has been transformed by a perspective projection matrix, what do the Z coordinate stand for? Distance from the 'eye'? Distance from the near clip plane? None of this?

Edit

I've set up a matrix using the glFustrum definition found here.

Then, I transform a 3D point with that matrix.

I'm left with a 3D point where X and Y are the coordinates of the point on the near frustum face, and Z, supposedly a depth information that I have a hard time exploiting.

Thanks!


Solution

  • The transformed z (that you use as denominator for dividing x and y) is the distance from the eye in the perpendicular direction to the projection plane, scaled so that the projection plane is at distance 1.