next up previous contents
Next: 23.2 Lighting Equations Up: 23.1 Projection Matrices Previous: 23.1.2 Orthographic Projection

23.1.3 Perspective z-Coordinate Transformations

The z value in eye coordinates, zeye, can be computed from the window coordinate z value, zwindow, using the near and far plane values, near and far, from the glFrustum() command and the viewport near and far values, farvp and nearvp, from the glDepthRange() command using the equation:

\begin{displaymath}z_{eye} = { { { { far \: near (far_{vp}-near_{vp})} \over far...
...)} \over { 2 (far-near) } } - {far_{vp}+near_{vp} \over 2 } } }\end{displaymath}

The z window coordinate is computed from the eye coordinate z using the equation:

\begin{displaymath}z_{window} = {
\left [ {{far+near} \over {far-near}} + {{2 \...
...}-near_{vp} \over 2 \right ] + {far_{vp}+near_{vp} \over 2 }
}\end{displaymath}



David Blythe
1999-08-06