What Shadowing techinque should I use?

Started by
28 comments, last by duhroach 19 years, 7 months ago
It looks like shadow maps are the way to go. I don't need soft shadows, because when I look outside at a tree and the sun is out I don't see a nice fade effect on the shadow I see a hard outline of the tree, or whatever the shadow is. I don't want any jaggie edges if possible. But speed vs. quality I would like a happy medium. So no one here suggests horizon mapping? Thanks all.
Advertisement
when rendering the directional shadowmap for a terrain

how would you do it

1. prerender the shadowmap at compile time for the entire terrain at a high resolution
or
2. render it when needed all x frames only for the culled scene with a lower resolution

http://www.8ung.at/basiror/theironcross.html
Well, if you were to only pre-render the shadowmap, that would make the shadows completely static. That might not be desirable. In that case you might as well have encoded the "shadows" in the diffuse texture map.

But since the directional light source will be representing the sun (or moon, or whatever), then that means that it doesn't have to be updated too often. The sun doesn't move that fast, anyway. Even though, regenerating the shadowmap is a relatively cheap render-pass, because you can disable everything except depth-writes. Shadowmaps are more scalable with the amount of geometry, compared to shadow volumes.
Quote:But since the directional light source will be representing the sun (or moon, or whatever), then that means that it doesn't have to be updated too often. The sun doesn't move that fast, anyway.


that's true only if you've got a completely static terrain with no moving entities on it. because the light doesn't move, doesn't mean you have to update your shadow maps less often... unless of course you render the dynamic object's shadows differently...
Quote:Original post by MARS_999
I have per pixel lighting up and running on my terrain. I want to add shadows, and not sure what method to use with per pixel lighting? I have the light position moving around in circle to simulate the sun. So the lighting is dynamic and the shadows would need to be also? I have looked at horizon mapping. Not sure if that will work or not? Thanks


For the terrain itself I woudld definitly use horizon maps. Horizon mapping (or a varient) is a really good fit for shadows of terrains on itself, and it is one of the few ways to have a selfshadowing bumpmaps. It also works well for any surface where objects are occluded in a continious way, which includes height map techniques. It is also really cheap to compute, and can optionally give you a soft to the shadow (which you probablly want to soften the aliasing).

If you want the terrain to shadow other objects (or the object to shadow the terrain), you have to use a seperate technique for that: Id buffers, shadowmaps, or stencils are the most common techniques. My personal advice would be to use either shadow maps or ID buffers. ID buffers would allow the terrain to shadow the object, Shadow buffers would also cause an object to shadow itself. It is harder to get good results with shadow and/or id buffers) then with stencil shadows, but the performance characteristics of Stencil shadows are horrible, especially for outdoor scenes.


So short answer: Use horizon map to self shadow the terrain, use shadow maps or id maps for the other shadows.




EvilDecl81
Re: shadowmap size problem for large terrain.
Read Carmack's idea on multiple-sized shadowmaps here: http://benryves.com/bin/jcqc2004keynotes.txt
Same idea by Jonathan Blow (look at the 2nd image): http://number-none.com/happycake/notes_8/index.html
Quote:Original post by sBibi
Quote:But since the directional light source will be representing the sun (or moon, or whatever), then that means that it doesn't have to be updated too often. The sun doesn't move that fast, anyway.


that's true only if you've got a completely static terrain with no moving entities on it. because the light doesn't move, doesn't mean you have to update your shadow maps less often... unless of course you render the dynamic object's shadows differently...


Good point, I didn't think about that.

Anyway, I found this thread. You should definitely read through it.
James Trotter> this thread happened a bit before the TSM paper came out, and would probably have converged to a similar approach if it had kept going..

Trapezoidal shadow maps: (there are a bunch of threads talking about it here in gpt) http://www.comp.nus.edu.sg/~tants/tsm.html

EDIT: sorry, didn't notice Yann already mentionned TSMs
I just read John Carmacks paper on Doom3 and whats next. He talks about pBuffers and the render to texture Extensions and their performace issue and nightmare to work with... I though about using this method but now am unsure. I am now thinking about using glTexSubImage and updating my shadow map texture every other few degrees instead of continually. This would be for my terrain only. I would have to come up with something else for my objects on the terrain.... Not sure what everyone else has to say about this....
for terrain shadow, you could go for simple vertex shadowing technique.
this is the simplest method but it's hard to make it look good. if you're interested, i wrote a little demo a while back. you can get it here : http://www.geocities.com/lionhttp/shadow3.zip

This topic is closed to new replies.

Advertisement