-2

I understand that the range of values in the OpenGL depth buffer typically go between 0 and 1. I have also read that to convert these values into a "distance from the viewer" you can use this equation

depth = nearPlane + ( farPlane - nearPlane ) * depthBufferValue;

Other sources of information state this is not the case because these values are non-linear and also depend on the type of project utilised.

I appreciate there are quite a few posts on this topic, however I just need a few pointers as to identify the correct information source.

  • 2
    See [How to render depth linearly in modern OpenGL with gl_FragCoord.z in fragment shader?](https://stackoverflow.com/questions/7777913/how-to-render-depth-linearly-in-modern-opengl-with-gl-fragcoord-z-in-fragment-sh/45710371#45710371) – Rabbid76 May 22 '22 at 19:59
  • Related posts are [Getting the true z value from the depth buffer](https://stackoverflow.com/questions/6652253/getting-the-true-z-value-from-the-depth-buffer) and [In OpenGL, how can I discover the depth range of a depth buffer](https://gamedev.stackexchange.com/questions/8050/in-opengl-how-can-i-discover-the-depth-range-of-a-depth-buffer) – Peter Lawrence May 22 '22 at 20:04

0 Answers0