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.
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.
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?
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.)
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.
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.
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.