Light Pre-Pass Renderer
This week I decided to try and implement other interesting rendering thechniques, and after Googling a lot I've stumbled upon the Light Pre-Pass technique.
It's a very simple technique that consists in pre-calculating all the scene lighting.
So I have made my own version of it. Many implementations just re-calculate the fragment positions from depth, but I think that that is just too messy.
The idea is pretty straight-forward. It can be done in just three passes:
And for the second pass:
This is the final result (Includes texturing and rim light):
That's it, until next time! 👍
It's a very simple technique that consists in pre-calculating all the scene lighting.
So I have made my own version of it. Many implementations just re-calculate the fragment positions from depth, but I think that that is just too messy.
The idea is pretty straight-forward. It can be done in just three passes:
- Render the scene Normals and the Positions to a FBO.
- Optionally, you can store some material parameters in the alpha channels of the Normal and Position maps like I did (Normal.a = Glossiness, Position.a = Specular Intensity).
- You can apply the normal and maybe the specular textures in this step.
- Into another FBO, render the lighting. This is where you calculate the light attenuation and the Lambert term for each light, based on the light properties from Pass 1.
- Here's where you bind the Normal and Position maps. Use them for the parameters for the light equation.
- Do a simple Forward rendering step and apply the lighting to the scene.
- Here you'll bind the resulting texture from Pass 2 and use gl_FragCoord.xy / ScreenRes as the texture coordinates since they're in screen space.
- Also here is where you apply the diffuse textures.
R | G | B | A | |
---|---|---|---|---|
COLOR_ATTACHMENT0 | Scene Normal | Material Glossiness | ||
COLOR_ATTACHMENT1 | Scene Position | Material Specular Intensity |
R | G | B | A | |
---|---|---|---|---|
COLOR_ATTACHMENT0 | Light Color (Lambert) | Specular (Phong) |
This is the final result (Includes texturing and rim light):
That's it, until next time! 👍
Skybet Casino | A Member of The Malta Gaming Authority
ReplyDeleteSkybet Casino offers a unique gaming air jordan 18 retro racer blue order experience air jordan 18 retro men red outlet and the potential for a long-term profit. Sign up for our new sportsbook offer and how to get air jordan 18 retro red suede receive a air jordan 18 retro men online free shipping welcome real air jordan 18 stockx