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

前端 未结 2 2030
你的背包
你的背包 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 07:01

    well in my case, i do it like that:

    Bind gbuffer framebuffer
    Render color, position, normal
    Unbind framebuffer
    
    Enable blend
    Enable depth testing
    
    glDepthMask(0);
    glCullFace(GL_FRONT);   //to render only backfaces
    glDepthFunc(GL_GEQUAL); //to test if light fragment is "behind geometry", or it shouldn't affect it
    Bind light framebuffer
    Blit depth from gbuffer to light framebuffer //so you can depth-test light volumes against geometry
    Render every light
    

提交回复
热议问题