How to visualize a depth texture in OpenGL?

前端 未结 3 1101
面向向阳花
面向向阳花 2021-02-11 01:52

I\'m working on a shadow mapping algorithm, and I\'d like to debug the depth map that it\'s generating on its first pass. However, depth textures don\'t seem to render properly

3条回答
  •  日久生厌
    2021-02-11 02:21

    Depth textures (2D) can be used just like any regular grayscale texture. The only problem might be that the values inside it are all too high and you only see a white texture. If that's the case play around with the z-near and -far planes that are used when creating the depth texture (or scale the values with a shader or maybe glTexEnv).

提交回复
热议问题