I’ve been spending the last few days trying to wrap my mind around GLSL lighting in OpenGL, but I still have a few questions.
So far, this is my understanding of the standard for lighting with deferred shading
- Render the scene to an FBO and keep the depth and color textures from the FBO
- Render the scene’s normal textures to another FBO
- Render each light (using full-screen passes) to another FBO passing the depth, color, and normal textures to the shader (as well as the inverse projection matrix for reconstructing position) using additive blending
- Render the color texture from the first FBO as well as the color texture from the FBO with the lights to the scene
If I’m thinking about this completely wrong or any of you know of a good tutorial or a better approach, I would appreciate your input