Sign in to follow this  

stencil shadows question

This topic is 3729 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
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

This topic is 3729 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this