How to draw from the inside of the light geometry in deferred shading

前端 未结 2 2056
你的背包
你的背包 2021-01-15 06:18

I\'m trying to implement a deferred shader with OpenGL and GLSL and I\'m having trouble with the light geometry. These are the steps I\'m taking:

Bind multit         


        
2条回答
  •  耶瑟儿~
    2021-01-15 06:56

    If i remember correctly, in my deferred renderer i just render only the backfaces of the light volume. The drawback is you cannot depth test, you will only know if a light is behind a geometry after the light calculation is done and discard the pixel. As another answer explained, you can do depth testing. Test for greater or equal to see if the backface is behind or on a geometry, therefore intersects with the surface of the geometry.

    Alternatively you could check if you are inside the light volume when rendering and switch front faces accordingly.

提交回复
热议问题