Jump to content
  • Advertisement
Sign in to follow this  
SiS-Shadowman

stencil shadows question

This topic is 4034 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've got several questions regarding stencil shadows. I've understood how to create the shadow volume, but I'm unshure how I need to change my render loop. Currently I'm doing this: For every mesh --find the lights that can illuminate this mesh --draw the mesh with the first light AND the ambient light --for every other light ----draw the mesh with the current light It is not optimized yet, but I want to get everything running before I spent weeks on tweaking the render loop. How do I need to setup the render loop to use stencil shadows? Everything I found on the net had a render loop that draws the scene about 5 times. I can hardly believe this is really nessecary.

Share this post


Link to post
Share on other sites
Advertisement
My system works like this:

For each renderable mesh, I have a "shadow proxy" which is a copy of the geometry with degenerates added so I can extruded it while keeping it sealed. This could be substituted for a low-poly version if need be.

My render loop runs twice, like this:

----

For each mesh:
-- Draw renderable meshes with fancy materials, lighting, etc.

Clear stencil buffer, Preserve depth buffer

For each "shadow proxy":
For each influencing light:
-- Draw shadow volume to stencil buffer (colour writes off)

Render subtractive full screen quad through stencil buffer to get shadows.

----

So, my shadows are "bolted on" as a second pass with the only interaction to my render loop being keeping a list of deferred shadow proxys.

Hope this helps?

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!