Jump to content
  • Advertisement
Sign in to follow this  
wusher

stencil shadow volume quirks

This topic is 5151 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
Advertisement
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
Oh, but it is... just try it :)

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
Guest Anonymous Poster
Okay, thanks for your help guys. :)

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!