Adding softness to shadows

In my efforts to make the shadows soft, based on the formulas for penumbras, I finally realized that my method does not support physically correct penumbra softness, but I will explain the reason for this when I do the tutorial.

Until then, here’s what I came up with, after applying some Gaussian blur to the final shadow image. (variable degree of softness)

2dShadowMaps 2009-10-01 23-40-40-79

2dShadowMaps 2009-10-01 23-41-11-51

Even if it’s not physically correct, I still think the softness looks good enough.

There’s also an interesting looking result when the radius of the Gaussian Blur depends on the distance from the light…

2dShadowMaps 2009-10-02 00-01-58-45

Categorized: XNA
  • http://2project.co.cc Gabriel Rotar

    That is pretty cool, the radius trick makes the light diffuse, witch is physically correct.

  • http://alexhogan.com Alex

    Wow – really cool! I’m really looking forward to the tutorial! Nice work.

  • Klinge

    Looks fantastic! Can’t wait for the tutorial!

  • http://indi.solubl.es Niko

    Amazing… Looks very nice, love to see that a tutorial is coming, thanks!

  • David

    Can’t wait for this, looks fantastic!

  • agentili

    Really good effect, looks pretty correct.

  • http://www.RelativeSpaceGame.com RelativeSpace

    That looks awesome, and efficient. Thanks!

  • http://martindevans.appspot.com/blog Martin

    Is this tutorial going to be published soon? I’ve been doing some googling around and I can’t find any sources on how to do this, so it would be really appreciated!

  • Christopher Harris

    Woohoo!

    I thought I was the first one to figure out how to render 2D shadows on the gpu, but it looks like you got to it before me. 😉

    I’m using a “stretchy” shadow method and drawing my objects over the shadow casters. I thought about using a gausian blur for the penumbra effect, but I didn’t think it would turn out that good, and the distance based method looks amazing!

    I’ll be implementing that in my light engine and adding credit for you.

    If you have any source for this, it would be much appreciated, regardless of the complexity / messiness. 🙂

  • Christopher Harris

    Or not.. I just read your method works on rasterized images. Now I’m very intrigued.

  • Brett

    A thought:
    Make the blur depend on the distance from the shadow caster, not the distance from the light source.
    The shadows that start far away from the light with blur using distance from light already have diffused light behind them when they start. This seems wrong to me.

    This looks great. Looking forward to the example. Keep up the good work

  • http://www.squigglyfrogstudios.net SquigglyFrog

    Would love to see this tutorial! Been trying to implement some shadows and they just don’t look right.. Trying to add dynamic shadows to 2D tilemap..