Deferred Rendering Sun

Started by
0 comments, last by MJP 12 years, 6 months ago
I am using cones and spheres to render spotlights and point lights to my light buffer. For the sun (directional light), I am rendering a fullscreen quad. The problem is with my fullscreen quad: I will execute my directional lighting pixel shaders over the skybox area, which is wasteful.

My thought was that when I laydown my gbuffer, I set the stencil buffer to 1 to mark the areas I have drawn to. Then when I render my light meshes, I only render to areas where the stencil buffer is marked 1. Is this the common solution?
-----Quat
Advertisement
Yeah, it's simple and effective since early stencil cull will kill most of the skybox pixels before they ever get shaded. You could also use dynamic branching to early out in your pixel shader, but in general that won't perform as well as stenciling.

This topic is closed to new replies.

Advertisement