View Full Version : Soft shadows - my turn

02-15-2003, 01:59 AM
Sorry about the crappy image, but I think you should see this: http://www.hut.fi/~ikuusela/images/softshadows.jpg

It's a technique I came up with when trying to antialias my shadow maps, and which to my great surprise easily expanded to soft shadows.


-Can be done with a single shadow map, in this case 256*256
-Works on any hardware that can do shadow mapping
-With only a small speed decrease from normal shadow maps. That scene runs in realtime on my tnt with 128*128 shadow maps. The limiting factor is slow render to texture.

-Only outer penumbra. Inner penumbra is possible, but requires an additional, depth peeled shadow map.
-Aliasing, need for tweaking, difficult for omni lights. The typical shadowmap stuff.

So it's not perfect, but it's by far the lightest soft shadow technique I'm aware of. There should be no major artifacts other than the ones mentioned in the cons-section.


02-15-2003, 04:20 AM
Looks nice! I didn't know TNTs were already able to do shadow maps !?

What do you mean by "outer penumbra" vs "inner penumbra" ?


02-15-2003, 04:36 AM
My tnt just keeps surprising me with the things it can do... No, it doesn't support hardware shadow mapping the way the new geforces do, but you can do basic shadow mapping on any hardware that supports multitexture, tex_env_combine and projective textures.

Inner and outer penumbras don't exist in real life, they're just terms I saw in some shadow mapping document. If you think of the shadow of an object, the inner penumbra is the soft section inside the corresponding hard shadow, and outer penumbra is the soft section outside of it.


02-15-2003, 07:05 AM
I bet you use the shadow mapping technique from Wolfgang Heidrich's phd.

02-15-2003, 10:22 AM
What do you mean by "outer penumbra" vs "inner penumbra" ?

Often you refer to the penumbra and umbra.

As usual, and picture says more than... http://www.cs.utah.edu/~bes/papers/coneShadow/shadow-node3.html

02-15-2003, 11:03 AM
No, I don't mean penumbra and umbra. The concepts are described in this presentation http://www.mpi-sb.mpg.de/~brabec/doc/talk_gi02.ppt
But I'm not using that technique. Nor am I using the soft shadows for linear lightsources, which is the only Heindrich algorithm I found.

Actually both of these techniques look like really complicated (and thus slow) to me. Search algorithms, computer vision stuff...

Think simple.


02-15-2003, 12:26 PM
No, I don't mean penumbra and umbra. [/B]

I know you didn't. I was trying to clarify the basic concepts of penumbra/umbra. The link I gave had a nice picture which explained this, the actual paper in the link was to me irrelevent.

02-16-2003, 06:43 AM
Oh yes, sorry and thanks for helping me clarify the concepts.

Anybody care to know how I did it?


02-16-2003, 07:40 AM
It would be interesting to know.

02-16-2003, 09:12 AM
It's like this:

The penumbras (or is it penumbrae, who knows...) are stored in the color channel of a shadow map, and the lighting gets modulated by them. Umbra is taken care of by the normal depth map comparision. If you don't trust that it works, see my screenshot, it features many different overlapping umbras/penumbras, all giving a visually ok result.

You draw the penumbras by drawing black quads on the silhouette edges into the shadow map. The quads are extruded in the direction of the vertex normals and have full opacity where they meet the edge, and zero at their other extent. Like edge antialiasing, you know.

The actual trick is to draw multiple quads per edge. Each quad is pushed away from the light so that it's depth gets greater, but it's projection on the shadow map remains the same. At the same time you make the quads wider so that the distant ones produce more blur than the original ones. The depth test will take care of the rest. When the shadow reciever is close to the caster, only the sharp silhouettes get drawn, and the further it gets, the more blurred silhouettes get visible.

I hope that makes some sense to you.


02-16-2003, 08:23 PM
>>>You draw the penumbras by drawing black quads on the silhouette edges into the shadow map. The quads are extruded in the direction of the vertex normals and have full opacity where they meet the edge, and zero at their other extent. Like edge antialiasing, you know<<<

Hey, that was my first idea. Thanks for doing the work for me http://www.opengl.org/discussion_boards/ubb/smile.gif

Ask Zed (I think it was him) who posted a topic about comming up a new super-duper idea, but he didn't want to tell us what it was, except it can do soft shadows of objects and the soft shadows of the bumpmaps.

02-16-2003, 10:11 PM
Yeah, it did cross my mind that this is what he is doing. You can get the bumps cast shadows, kind of, if you somehow use the bumpmap to affect the silhouette opacity. I used to do something like that to fake displacement mapping. That's just for the silhouettes though, for the other bumps you would have to use stuff like horizon maps.

Two things don't match though, he said he isn't using shadowmaps, and he is having trouble implementing it on a geforce2. Must be something else.