# Depthbuffer

Hi,
I have a question to the depthbuffer. I can read it out for a perspektive camera and transform it in real distances. Is it true, that the distance the depthbuffer gives out is not the distance the point is seen, but instead of this, it is the distance of the on the optical axis of the camera projected point?

If I understood your question, yes it is true. The depth buffer represents the distance of a projected point from the eye. You can read more about depth buffer or z-buffer in http://en.wikipedia.org/wiki/Z-buffering

Hope this can help

I think its a little bit different. One expect one get the distance between the origin of the camera and the object seeen under a certain angle. But you get the distance not along the ray to the object but the distance along the optical axes, when you expect the object is projected on the optical axes.
I have seen this problem, when the camera stands in front of a wall and the optical axes is perpendicular to the wall. Every point of the wall has the same distance, although the angle of the point is different.
Has anyone an explanation to this phenomena?

That is expected. Z coordinates is not a distance, but a measurement along Z axis.

Thanks. That explains this.

The depth value represents the distance of a fragment from the near clipping plane, which need and often should not be coincident with the eye.

• Chris

It’s not a distance, it’s a measurement.

Firstly, in a standard perspective projection, the measurement is typically non-linear whereas the concept of “distance” is linear; this means that for a given distance d which equates to a Z value n, don’t expect a distance of 2d to give a measurement of 2n.

Secondly, factors such as your glDepthRange and/or vertex shader operations may modify the final projected Z value in ways that don’t correlate to any of the above.

I agree with you, except for the point that measurement is different from distance. All measurements are some form of distance.

• Chris

Not really, received radiation dose is measured in mSv, and really this is not a distance, by any stretch of the word.
And what about a measuring tool giving the square root of distance ? Is that still a distance for you ?

I think you’re conflating distance with spatial distance. And distance with Euclidean distance.

• Chris