PDA

View Full Version : (dynamic) shadow mapping and point lights


roel
09-26-2005, 09:13 AM
Hi, I was just reading this interesting article about soft-edges shadows using shadow mapping:

http://www.gamedev.net/reference/articles/article2193.asp

which stated "In this article, we only deal with spot lights, but this technique can easily be extended to handle point lights as well."

My question: does this mean rendering for another five (six in total) frusta to support point lights? Or is there a smarter way?

Besides that, please some comments regarding shadow mapping in general: I'm about to build a very humble engine, is shadow mapping a good choice at all these days? Or should I stick with shadow volumes?

Thanks.

Reedbeta
09-26-2005, 10:25 AM
As far as I know, the only way to do omnidirectional shadow mapping is to render six shadow maps to an unrolled depth cube map (since "real" depth cube maps aren't supported in hardware) and then write a pixel shader that figures out which part of the unrolled cubemap to look at for the shadow comparison. This is a real headache, but can be done (check my website for an example). A floating-point cubemap can also be used for the depth, but in this case one loses the benefits of doing the shadow comparison directly in hardware (e.g. automatic PCF on high-end cards).

As for shadow mapping vs shadow volumes, the trend in high-end graphics these days is definitely toward shadow volumes, as it simply requires a lot of pixel processing power be thrown at the scene, no special geometry processing needed, and also allows the possibility of doing things like soft shadows. However, in some ways shadow volumes are easier to get working, especially for omnidirectional lights.

roel
09-26-2005, 10:54 AM
Thanks, Reedbeta. But I guess that you mean "...definitely toward shadow mapping" instead of "...definitely toward shadow volumes"?

coelurus
09-26-2005, 02:04 PM
Dual-paraboloid shadow mapping is one solution:
http://www.mpi-sb.mpg.de/~brabec/doc/brabec_cgi02.pdf

Reedbeta
09-26-2005, 03:02 PM
Er, yes. The trend is toward shadow mapping. :-D

The dual-paraboloid shadow mapping looks interesting, but unfortunately requires the scene be sufficiently finely tesselated in order to get accurate results.

m4x0r
09-26-2005, 05:21 PM
In my experience the tesselation issue isn't that big of a problem. We tend to tesselate meshes quite a bit for the current generation of hardware and the biassing that is necessary to eliminate self shadowing artifacts also eliminates the artifacts you get from dual paraboloid shadow mapping.

Max

m4x0r
09-26-2005, 05:28 PM
As far as I know, the only way to do omnidirectional shadow mapping is to render six shadow maps to an unrolled depth cube map (since "real" depth cube maps aren't supported in hardware) and then write a pixel shader that figures out which part of the unrolled cubemap to look at for the shadow comparison. This is a real headache, but can be done (check my website for an example). A floating-point cubemap can also be used for the depth, but in this case one loses the benefits of doing the shadow comparison directly in hardware (e.g. automatic PCF on high-end cards).

Unfortunately this isn't supported on ATI cards (and my understanding is that it never will be due to patent issues), so you need to have a separate floating point path anway. Alternatively ATI supports the DF16 fourcc render target type, but it still doesn't do the depth comparison for you.

Max

Reedbeta
09-26-2005, 07:06 PM
It does the depth comparison (that's the entire point of a depth format). Just not PCF.

m4x0r
09-26-2005, 09:12 PM
It does the depth comparison (that's the entire point of a depth format). Just not PCF.
Do you know how to do this in Direct3D? As far as I know it's not possible, but I would be very interested in learning how since then I could unify the NVIDIA and ATI shadow map shaders in my engine.

Max

Altair
09-26-2005, 09:24 PM
It does the depth comparison (that's the entire point of a depth format). Just not PCF.
No, it doesn't do depth comparison. The entire point is that you get double speed depth writes by disabling color writes and don't need extra color surface.

Cheers, Altair

roel
09-28-2005, 12:04 PM
Coelurus or m4x0r or anyone else, do you have any experience with dual-paraboloid shadow mapping? It looks promising indeed, but how fine has the tessellation to be? And how visible are artifacts when the tessellation isn't sufficient enough?

m4x0r
09-28-2005, 03:54 PM
Coelurus or m4x0r or anyone else, do you have any experience with dual-paraboloid shadow mapping? It looks promising indeed, but how fine has the tessellation to be? And how visible are artifacts when the tessellation isn't sufficient enough?

If your tesselation isn't high enough you will get self shadowing artifacts (dark spots) in the middle of large triangles where the correct parabolically warped geometry would pull away from the linear approximation of the warp.

For curvy things like characters you'll have no problems since these tend to have plenty of tesselation. In my experience, a 1m edge length is sufficient tesselation for a 0.01m self shadowing bias.

Max