Shadow Mapping

Hi! I’m looking for advice on implementing shadow mapping… So far i’ve been reading the presentations from nvidia site but their source codes looks too confuse to me. Maybe I’m skipping some theory that should be read first? Anyway, how did you learn that? Any tips for me?

Also, could you give me an idea of how many different approaches are implemented in a game? Let’s say a good looking shadow mapping, another one using volumes…
And what is the order of complexity and performance of these approaches?

Thanks!

Originally posted by NOAH IV:
Hi! I’m looking for advice on implementing shadow mapping…

Hi there,

I spent some time in the last three weeks to experiment shadow mapping and how it could be implemented in my work. I really was a fan of shadow maps however, after the experiments, I am now interested in shadow volumes more than shadowmaps. So, my advice is that they not so good to use.
The main concern was that I plan to use projected lighting a lot. For that reason, shadow maps would have created similar artifacts, thus looking better to the eye, however, keep reading…

So far i’ve been reading the presentations from nvidia site but their source codes looks too confuse to me. Maybe I’m skipping some theory that should be read first? Anyway, how did you learn that? Any tips for me?

I used the things you have (I got it from NVSDK) plus some ATi papers on pBuffers and render-texture, you really should not need more than that. About your confusion… well, I don’t know how can I help you but I am sure you will figure out if you keep spending time on them.
TIP: if you use RTT, make sure mipmaps are in place (or turn off mipmapping at all!) or you’ll get some pretty ugly troubles. Doing some DrawPixels could help a lot!

And what is the order of complexity and performance of these approaches?

After my experience, I feel implementing shadow maps effectively is not easier than shadow volumes. The main concern is that they suffer way too much from the precision issue. For most games with closed spaces this won’t be a problem but for me it is. It is somewhat easy for something to get closer enough to the light source so much it just ruins up everything.

I think the projective texturing approach is very good to do lighting, but not for shadowing.

Another problematic feature of shadow mapping is implementing a way to render them in an optimal way when fragment programs are used. For example, since the shadow map is depth-only, there is no such point in rendering using this or that feature (bump maps for example), but you can’t just disable color writes or something since the FP may be KILling fragments in a non-obvious way. Shadow volumes are somewhat easier there since vertex programs are somewhat easier.
Considering shadow maps in a VP+FP driven world, they look much more complicated.

So, I was a real fan of this technology remember it, however, my best advice is to leave them out of the way.

I initially liked it because I heard Pixar uses them in renderMan, however I now think the disavantages of the technology are way too much. Performance wise, I can’t tell since the simplification and shiluette algo used for shadow volume generation are the unknown factor. I don’t want to express an opinion about that until I test it more extensively however this requires a lot of work and will take some time.

Simply put, what most whitepapers does not tell you (well, they tell you, but just a little) is the precision issue.

I hope you can find this useful even if I think this will make you even more confused.

Bye.

Obli, thanks for your comments!

I’ll take a look at shadow volumes more carefully now.

And what about performance? Which method is likely to provide faster results?

My first experiment (shadow maps) gave me 1 fps !

Is it possible to know how they did in “NeverWinterNights” for instance? There are more than 5 shadows in different directions!

Thanks a lot!

Originally posted by NOAH IV:
…My first experiment (shadow maps) gave me 1 fps !..

Sorry but I cannot help you here since I am running on nvEmulate however, I had a chance to test it on a FX5600 (Ultra?) and got very disappointing results. I don’t want to tell more - I had just few minutes do benchmark so I don’t think I got meaningful results.

As for the game, I don’t have it (I know a friend which is playing it) but from the few screenshots I’ve seen, I think they are using shadow volumes.

EDIT: I forgot to mention the fact that shadow maps can’t work at infinite distance (at least for the precision issue) - this is the point in which shadow volumes get a real edge.

[This message has been edited by Obli (edited 10-01-2003).]