Sign in to follow this  

Different Stencil Shadow Techniques

This topic is 4324 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 was wondering, what are the drawbacks of using the "gray square" method when doing stencil shadows in contrast to the "traditional" approch. E.g. drawing an alpha blended square to shade the stenciled shadow regions in contrast to an ambient pass plus stenciled light pass(es). The "gray square" method obviously looks faster since it involves only one render pass

Share this post


Link to post
Share on other sites
Light is additive. If you have multiple lights in your scene, the ambient + 1 pass per light is going to work well. The substraction method (rendering a dark quad) will look wrong.

Y.

Share this post


Link to post
Share on other sites
This is something that I've been wondering recently too, as my 3D engine currently uses the "gray square" method, and I want to switch to the more accurate algorithm.

But one problem I've hit is that the "gray square" has one advantage - it's very easy to fake shadows cast by translucent objects, as you just reduce the alpha component of the shadow you are drawing.

Is there an easyish way of doing this with the more traditional/accurate approach? I've tried to think of a few, but I can't think of an easy approach.

The reason I need this is because I have objects fade out when they die - it looks very unnatural if the shadow just blinks suddenly out of existence, it's far nicer to watch the shadow fade out gradually.

Share this post


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