Sign in to follow this  

stencil shadow volume quirks

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

Hi, this is my first post although I've been visiting the site and browsing the forums for a while. I've made a little demo to test my understanding of stencil shadow volumes after reading this guide to how they work. It seems to be working fine except for a little quirk. Shadows are being cast right through models and appearing on the other side like this: There are two shadow casting triangles there, the front one's shadow is cast onto the bigger one and again onto the ground and the larger triangle casts a shadow onto the building and again onto the side face of the building where the shadow volume stops intersecting (this is the problem). I don't think this is a mistake in the code as I can see why it happens. Are there any ways to stop it? I'm not extruding the shadow volumes infinitly but since a triangle can be anywhere in the world I'm not going to be able to use a set extrusion distance to eliminate the problem as this would cause legitimate shadows longer than this distance not to show. Any ideas? Thanks, Duncan.

Share this post


Link to post
Share on other sites
This appears to be normal behaviour; shadow volumes aren't supposed to be blocked by objects standing in the way. You can try to cap the volumes before rendering them, or make the building cast shadows itself.

Hope this helps. [smile]

Share this post


Link to post
Share on other sites
why doesnt your building create a shadow? if it did, you'd never notice this effect.

your algorithm might be assuming that all things cast shadows, and therefore, it doesn't need to worry about stopping a shadow after it hits a polygon.

that said, i'm ignorant of most things 3d...

Share this post


Link to post
Share on other sites
Hmm, good point. The building doesn't cast shadows as I just quickly knocked it up with quads which i've not got casting shadows yet.

Would all of those glitches be hidden in every possible situation if every poly in the world casted shadows? Even with mutliple light sources? Surely it can't be that simple. :)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Of course full, real time shadows are easy! For a simple scene like the one you have in the screenshots. Add 5+ lights and a few thousand (animated :) ) triangles, and it wont be that easy to do the "real time" part.

Share this post


Link to post
Share on other sites

Q:
Would all of those glitches be hidden in every possible situation if every poly in the world casted shadows? Even with mutliple light sources? Surely it can't be that simple. :)

You are right! But, whit one light this will work. Multiple lights however is done by rendering one pass for each light, and then adding them together... Each pass with one light would equal to rendering with one light, and in that matter, it should work!

If you try to do multiple lights with stencile shadows in one pass, you would have to fake, or you would only see polys in no shadow at all!

Share this post


Link to post
Share on other sites

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