• Advertisement
Sign in to follow this  

Deferred Rendering Sun

This topic is 2308 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement