View Full Version : What is depth value refer to in OpenGL?

04-08-2007, 08:46 PM
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 :)

04-08-2007, 11:42 PM
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.

04-09-2007, 11:00 AM
it's always near plane to object point in the depth buffer.

04-11-2007, 01:14 AM
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:


04-11-2007, 01:16 AM
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.

Kumar K
04-11-2007, 01:49 AM

may be this is what you are looking for...

04-11-2007, 03:39 AM
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)

04-11-2007, 06:19 AM
The same topic. already discussed here couple of monthes ago:

04-12-2007, 11:09 PM
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.