Logarithmic Depth Buffer OpenGL
I've managed to implement a logarithmic depth buffer in OpenGL, mainly courtesy of articles from Outerra (You can read them here , here , and here ). However, I'm having some issues, and I'm not sure if these issues are inherent to using a logarithmic depth buffer or if there's some workaround I can't think of. Just to start off, this is how I calculate logarithmic depth within the vertex shader: gl_Position = MVP * vec4(inPosition, 1.0); gl_Position.z = log2(max(ZNEAR, 1.0 + gl_Position.w)) * FCOEF - 1.0; flogz = 1.0 + gl_Position.w; And this is how I fix depth values in the fragment shader: