What is depth value refer to in OpenGL?

Dear everyone,

who knows what is depth value refer to in OpenGL? Is it refer to the distance from the viewpoint and the objectpoint, or the distance from the nearplane to the objectpoint?

I am looking forward to your reply!

Thanks before :slight_smile:

It could be any of them unless you put it into context as to what you are talking about. Post a paragraph or something here.

It could also be the screen space depth value, 0.0 to 1.0 range.

it’s always near plane to object point in the depth buffer.

It is the value stored in the depth buffer (nominally 0-1) and that can be calculated using an equation derived from the transformation process through the projection matrix and the frustum stored on it.

It is a non linear function of frustum near, frustum far and eyespace z.

Read question 12.050 here:


Can anyone find a reference for deriving eye z from depth value read from OpenGL, Google search let me down and I lost a link to an awesome paper that not only presented the equation but derived it too.


may be this is what you are looking for…

theres a couple of wyas ive seen this is the easiest/fastest

D = far*near / ( far - z * (far-near))

(then again u prolly mean something else)

The same topic. already discussed here couple of monthes ago:

Kumar, yup that’s the one although that website was blocked due to a bogus security certificate. Adding Hoff to my google search found the original.

Google for Hoff deriving opengl and it finds the paper.