View Full Version : Computing depth buffer value

01-19-2002, 05:59 PM
Suppose I have a viewport looking down the -Z axis. I have the distance of the viewport from the Z axis, the Z value of a vertex, and the ZNear and ZFar clipping plane values.

Now how do I figure out what the depth buffer value is going to be under that vertex?

I'm currently doing:

but that doesn't work quite right.