PDA

View Full Version : how to make shadows in 2007



JanHH
02-17-2007, 08:03 AM
Hello,

i haven't worked on my OpenGL project sinced 2004, but now it comes up again. I am asked to implement shadows, and before I start I just wish to know which shadow technique is the preffered one.. as I have no idea how much OpenGL has evolved since 2004. Back then, we choose to do perspective shadow mapping, but never got anywhere, and then the project was cancelled. The gfx is terrain, not indoor, i.e. driving simulation.

Which shadow technique should I search for?

Thanks and regards,
Jan

Brolingstanz
02-17-2007, 09:36 AM
I really like the split frustum idea(s) (e.g. Parallel Split Shadow Maps (PSSM)).

It's not perfect, but then what is.

k_szczech
02-17-2007, 01:23 PM
It pretty much depends on what should cast shadows and what should receive it.
Stencil shadows are perfect for large number of light sources with small radius.
If you need to cast shadows from plants (or anything that uses alpha test) or you want soft shadows, then you have no alternative but to use shadowmaps.
Shadowmaps can also be stored and reused across many frames of animation - that can sometimes be very usefull.
For large outdoor scenes with one dominating light source (sun) and lots of plants you can use perspective shadow maps (PSM) - that's a bit complex though - you should get yourself familiar with simple shadowmaps first.

JanHH
02-18-2007, 02:57 AM
Yes, alpha test is used (for plants). So it seems like not so many things changed according to shadows, as using PSM was the choice we made back then in 2004.

Thx
Jan

knackered
02-18-2007, 10:45 AM
well it was only just over 2 years ago, what do you expect?
Not much has changed over the last 2 years, except the number of SM3.0 cards in circulation has increased.

stefan
02-20-2007, 10:42 AM
Originally posted by knackered:
well it was only just over 2 years ago, what do you expect?
Not much has changed over the last 2 years, except the number of SM3.0 cards in circulation has increased. Actually I don't agree. Cascaded Shadow Maps have become popular in the last 2 years, VSM have been introduced 2006 and I think quite a few interesting questions arise:
Render to a standard depth buffer or use a floating point buffer?
How to filter the shadow map (Nvidia PCF vs. PCF in the pixel shader vs. VSM)?
Whether to use TSM, PSM, LISPM or CSM and how to filter the distorted shadow map?
...

Yours,
Stefan

knackered
02-20-2007, 10:55 AM
Oh there's plenty to discuss about shadows stefan, don't get me wrong, but nothing fundamental has changed over the last 2 years. There's been plenty of research by academics with plenty of time on their hands, resulting in plenty of promising approaches, but it still comes down to the same old compromises. JanHH just has to use google a bit, then come back with some more specific questions.

(cascaded shadow maps are pretty old hat, y'know stefan...they were 2 years ago.)

Sunray
02-20-2007, 12:06 PM
Cascade shadow maps are probably the easiest and most stable method IMO. Very easy to implement, no bad worst cases, only poor (but not that poor) performance. :)

knackered
02-20-2007, 12:41 PM
Yes certainly better than VSM! God knows why stefan mentions VSM.
I'm sniffing around the old smoothies paper at the mo...
http://people.csail.mit.edu/ericchan/papers/smoothie/

stefan
02-20-2007, 10:37 PM
VSM sound interesting because they promise to allow high quality and fast filtering and reduce projection aliasing. But I have to admit that my implementation was both very slow in comparison to a standard depth map with Nvidia PCF filtering and full of artefacts (light bleeding) (and I'm not sure whether it's me or VSM causing the problems).
BTW there recently was a thread by the VSM inventors that talked about some improvments ( http://www.beyond3d.com/forum/showthread.php?t=38165 ) that looked very interesting. That's why I mentioned VSM.

mogumbo
02-21-2007, 03:16 PM
Hey JanHH, I settled on PSSM after reading about a lot of different techniques. And after implementing it completely I'm still very happy with it. PSSM gives you consistent results and, as far as I know, is the only technique that can handle a large scene without having that dueling frusta problem. Someone please correct me if I'm wrong about that.

In addition to handling transparent objects, I also prefer shadow maps over stencil shadows because of their flexibility. They seem more versatile when it comes to soft shadow techniques. Also, if you have a height map you can offset your shadow map texcoords to make your shadows appear to conform to a bumpy surface. I've never seen that done with stencil shadows.

In choosing PSSM I was mainly focusing on the geometric aspects of shadow mapping. I haven't thought ahead to using any of the various soft shadow techniques yet. It would be interesting to see a matrix describing pitfalls associated with all geometric techniques vs. all filtering techniques.

oc2k1
02-23-2007, 02:49 AM
I prefer dual parabolic shadows for point light sources. http://sourceforge.net/project/screenshots.php?group_id=186618&ssid=53238
Without a geometrieshader, it will need 17 passes. (2 per light and 1 final). With geometrieshaders it should be possible in 2 passes with indepence to the number of lights.

Some about smoothies:
They cost minimum 2 lookups, but the need a extra pass for generating the map. If the ultra soft shadow isn't needet I use the fragmentoffset (subpixeloffset from SSAA) to get different samples from the shadowmap. A higher AA improve also the shadow filtering quality, people without a highendsystem can switch off AA (or use a MSAA) to save performace.

ZbuffeR
02-23-2007, 12:59 PM
Hey this "Lumina" project looks very promising !
I was quite disappointed by the typhoon labs dropping "Shader Designer" support on linux.

I am eager to try Lumina for quick GLSL prototyping...