![]() In this thread, there is a nice explanation about the non-linearity of the depth buffer: But z values are linear in screen space (see here). There is more precision close to the camera (or eye) and less precision far from the eye. In a perspective projection, the z buffer value is non-linear in eye space: in short, depth values are proportional to the reciprocal of the z value is eye space (see here). vec4 sceneTexel = texture2D(sceneSampler, uv) Here is the GLSL source code of this post processing shader: ![]() On the left part, you see the linearized depth buffer values (see the function LinearizeDepth()) while on the right part you see the values from a direct depth buffer reading (these values are non-linear – more explanations below). Geexlab-demopack-gl-21/d44-depth-buffer/main.xml file.ĭepth buffer (or z buffer) visualization is implemented with a post processing filter (see details in the demo source code). Unzip the demopack archive, and load (drag and drop) in GeeXLab the ![]() The demo is available in the GeeXLab OpenGL 2.1 demopack: Here is a demo that shows how to visualize the depth buffer in GLSL with GeeXLab. This post can be seen as a reply to this thread.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |