next up previous contents
Next: C..2 Lighting Equations Up: C..1 Projection Matrices Previous: C..1.2 Orthographic Projection   Contents

C..1.3 Perspective z-Coordinate Transformations

The $z$ value in eye coordinates, $z_{eye}$, can be computed from the window coordinate $z$ value, $z_{window}$, using the near and far plane values, $near$ and $far$, from the glFrustum() command and the viewport near and far values, $far_{vp}$ and $near_{vp}$, 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}



2001-01-10