Archived

This topic is now archived and is closed to further replies.

robert_s

How to make stencil shadows soft (ie. soft edges)

Recommended Posts

If there was an easy way to get soft stencil shadows, don''t you think Doom3 would be using them?

Stencil shadows are fundamentally a boolean in/out test, theres no good clean way to extend that to proper soft shadows. Theres an ugly hack of juddering light sources and re-rendering multiple times, but thats neither big or clever.

The current best method for soft shadows is shadow maps, but that needs quite up to date hardware (and isn''t accurate, its just a reasonably good looking approximation).

Share this post


Link to post
Share on other sites
You can make stencil shadows soft by rendering the on/off mask into a render target, then blurring it based on how far away the pixel is. Blurring with depth approximates perspective on the soft shadow boundary. You do get bleeding on object edges, but you can fix that by using the trick of ignoring blur samples that have a large depth delta. This is also used in one of the ATI DoF samples.

Here are some screenshots of this technique (doesn''t ignore blur samples though):

http://www.mhalpin.34sp.com/images.html

(Top 4 screenshots)

HTH

Matt Halpin

Share this post


Link to post
Share on other sites