Shadow Mapping

Started by
7 comments, last by Guoshima 18 years, 4 months ago
Ok, I know this has been asked a lot (and I've read over many posting so far for information), but what are good methods for shadow mapping? I've been looking a lot into Shadow Silhouette Maps, but I can't tell if they would work for omni directional light sources or not. All the screens I've seen (and what I can gather from the paper), all use a directional light source, does this method work for omni directional light sources as well? What other methods are there to improve upon shadow mapping? What can I do to remove the (all too persistent) visual artifacts? I haven't looked into shadow mapping for a while, so I am not sure what is new and what's old (a lot of the methods I am finding I remember from before, so are there any new developments?). Thanks
Advertisement
I ve been looking at this issue. I assume the Shadow Silhouette Maps you mentioned is the same as the classic stencil method, which calculates silhouette edges at run time.

The other popular one is projective shadow mapping, which I have chosen to implement over the stencil method.
Check out this tutorial about Shadow Mapping. Make a shadow engine with point lights.
See "Shadows that don't stuck" at:
http://www.humus.ca/index.php?page=3D&&start=40
"Technocracy Rules With Supremacy" visit: http://gimpact.sourceforge.net
Humus's method is pretty much what I have, but unless you use high resolution textures for the shadow maps, it gets very blocks and pixelated. It also has a problem that you need to offset the values a bit so that front faces of surfaces don't shadow themselves (I know, you can render the back face), but it's still not overly robust.

I will have to look more into perspective shadow maps, as the screen shots I have seen look nice, but do they work for point lights?

Shadow Silhouette Maps are a method of calculating the edges using a shadow map (render the scene from the lights point of view, then calculate the silhouette from THAT). This is an improvement over traditional stencil shadows in that you don't need to manually calculate the silhouette or enforce geometry restrictions anymore. Sadly, I've only seen the one paper on this method and nothing more.
May you'd take a look to the Ogre Library. It has a method for calculating shadow volumes with a Cg program. But the silouettes are calculated by hand. But if you precalculate an adjacenty list array of the model triangle list, you can save a lot of CPU for calculating silouettes.
(Adjacency array is the connectivity of each triangle edge).
"Technocracy Rules With Supremacy" visit: http://gimpact.sourceforge.net
In my experience a good way to implement shadow mapping is to go with a very standard appraoch, and optimize. Render your light views toa floating point buffer, project it as a cubemap in a shdaer and do the depth check, and use soe kind of bias to avoid flickering. Then blur the entire result using a fast gaussian blur shader. Of course you need a decent resolution for nearby shadows, at least 256*256, but the blurring helps. The secret to making this fast is using LOD, meaning that any lights not nearby use a muich smaller shadow map.. you can have as many levels of shadow map res you want, but three is probably enough, and of course you want to limit the number of active lights at anyone time. Also, you dont need to update a light if nothing near it has moved or changed.
Quote:Original post by xycsoscyx
Ok, I know this has been asked a lot (and I've read over many posting so far for information), but what are good methods for shadow mapping?

I have looked a lot into different shadow techniques for large scale directional shadows (for sun, etc.) recently and based on that the short answer is none (:

There has been many ways to try to address shadow mapping issues, but I haven't found yet anything that really solves those problems in an efficient and practical manner. All shadow warping techniques (Trapezoidal/(Practical) Perspective/Light Space Perspective Shadow Maps) have stability problems where shadows are degenerated to Uniform (regular) Shadow Maps when viewed from light (or opposite) directions. Don't believe the screenshots/videos/demos as they are just trying to promote their techniques like a crooked car salesman ;) There have been improvements to those techniques by rendering multiple shadow maps (e.g. http://legion.gibbering.net/projectx/paper/shadow%20mapping/), but to my understanding it becomes quite expensive from memory and performance point of view. Also there's the unit cube clipping optimization, but it requires scene analysis and isn't the solution in general case.

I believe instead of referring to "Silhouette Shadow Maps" technique by Pradeep Sen et al, which uses the piecewise linear approximation of silhouette, you refer to the "An Efficient Hybrid Shadow Rendering Algorithm" by Eric Chan et al? The hybrid technique looks decent improvement over stencil shadows, but you still have to process large shadow volumes, have to have special geometry for shadow extrusion (on GPU of course) and it doesn't support 1-bit alpha shadows which is necessary for complex shadow casters. The actual Silhouette Shadow Maps -approach on the other hand looks impractical on todays GPUs.

Cascaded Shadow Maps has received a lot of buzz lately, but I'm not quite convinced it's good way to go. It requires quite a few shadow maps being rendered (thus consumes fair a mount of memory / performance) and I'm not quite convinced about the quality you get with that investment. It's way more stable than shadow warping techniques though, but if you are ready to render multiple maps anyway, maybe the one with trapezoidal one would give better results.

I read a bit about "Alias Free Shadow Maps" (by Timo Aila & Samuli Laine) and "The Irregular Z-buffer and its Applications to Shadow Mapping" (by Gregory S. Johnson et al) just for inspiration as they address shadow mapping problems, but are not possible to implement on GPUs to my understanding. If you find a (practical) way, let me know! (:

Besides all that there's of course the omni-directional shadow mapping problem you were mentioning. There's a lot of other different approaches too (deep shadow maps, multi-depth shadow maps, etc.) but from the quick look they don't provide practical solution to shadow mapping.

Cheers, Altair

[Edited by - AltairX on December 4, 2005 8:14:40 PM]
Alas, that's the result that I am running into. Currently, I am just using a basic shadow mapping technique (render the geometry backfacing into the shadow buffers, then just projecting that onto the scene and checking against the current depth during lighting).

Fortunately, with all the other lighting active, it doesn't exactly look terrible (with realtime glass and the sort, it actually looks pretty nice), but I think I'll look into some less realtime approaches for global lighting.

That was my biggest gripe with shadow mapping, it doesn't translate well to larger and outdoor areas. I am looking into mixing shadow mapping for detail, and spherical harmonics for global, and see how it works together.

Does anyone know any good approaches to true smoothing of shadows? As in, multisampling to smooth the edges based on distance (instead of just bluring the whole thing)?
well I agree with the observations of AltairX. I also tried almost all of them and none are really satisfying. A nice article about all this can be found here:

http://www-gs.informatik.tu-cottbus.de/~wwwgs/Shadow_Mapping.pdf

I am currently implementing VSDCT which should increase performance and quality for omnidirectional shadow maps (more information on this technique can be found at ShaderX3 (which has an article by an nVidia guy .. shouldn't he write his articles in GPU Gems ?!?)). Hope the results are nice now, since I think I did almost all the possible optimizations to my omnidirectional shadow maps which I came along ..

As for directional lights, and I don't really have a solution yet. Could someone pls explain me a little bit more how the Cascaded shadow maps work, because I don't think I completely get the idea here. Is it based on this idea:

Instead, allocate N shadow maps, each of size 1024x1024. Each of them cover an exponentially larger area, with the lower middle of the map centered on the camera. Thus, with three maps, the first map may cover 100x100 meters (for a 0.1 meter texel size); the second may cover 300x300 meters; the third may cover 900x900 meters. When you render something, you pick the highest-resolution map that entirely covers the object. Thus, if something is 20 m in radius, positioned 90 meters out, it would extend out to 110 meters, and thus be shadowed by the secnod shadow map. An alternative is to use both maps for whatever overlaps boundaries. (by hplus0603)

because I tried this, but the result wasn't really good. Still very pixelated, even when using 2048 x 2048 textures for 50x50. But I am not doing any scene analysis to construct the unit cube clipping matrix yet, so this might help a lot here.

This topic is closed to new replies.

Advertisement