Shadow Mapping or Shadow Volumes?

Started by
7 comments, last by Tessellator 18 years ago
i've now come to the point, where i have to decide wether i should use shadow mapping or shadow volumes to create shadows on my terrain and its objects. i tend to use shadow volumes, but i'm not shure. as far as i know shadow mapping doesn't need that much computation power than shadow volume does, but it precision isn't that good. i saw some artifacts at the edges of the shadow ( obvios because a texture is used and it's resolution is not infinite ) shadow volumes also tend to make problems because of the artifacts on the self shadowed mesh. i want to achieve a good quality, because the self shadowing is very important to me: the hills should cast shadows onto mountain sides and canyons *dream* i saw that either a triangle is shadowed or it is not, thus there should be really crappy "errors" when the light doesn't come straight towards the triangle. perhaps you can help me decide what to use :)
Advertisement
Quote:Original post by SiS-Shadowman
perhaps you can help me decide what to use :)
I think the 'Graphics Programming & Theory' regulars might well be better placed to answer such a broad question [smile]

It probably depends on various other factors. Shadow mapping tends to require more shader-related work, whereas you can do shadow volumes on older hardware (if its fast enough). Also, what sort of lighting scheme are you thinking of? single directional sunlight? lots of individual lights?

A while back I saw a very impressive demo of PRT/SH for lighting on a terrain - complete with some beautiful looking soft shadows in a day/night cycle... Could be another option!

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

i am currently using a single directional light, but later on, i will use probably 1 or 2 point lights in adition for lamps etc..
i don't have anything against more work with shaders, cause i need to work alot more with them ;)

i don't really know what technique is better, but later on, i want objects also to be shadowed by the terrain and vice versa. perhaps there is a difference wich technique is the more powerful for this shadowing (?)

and to the hardware. the app isn't supposed to be running on old hardware.
i won't have any problems with using the newest hardware shaders or other high requirements.
I think a modern shadowing system should be done with shadow mapping, for many reasons. For one thing, when rendering shadow buffers you can render any geometry into it, including stuff with alpha testing, for things like trees and foliage-- you also can have sprites cast shadows. Then of course you dont need to bother with shadow volume construction, extrusions and so on.

Also it's much easier to control level of detail by switching between different resolution render targets...plus its easier to blur the shadow image for softer shadows.

In my engine i use full blown omni-directional depth buffer shadow mapping for indoors scenes with point lights, and for outdoors i use a single render target, with no depth buffer, and just render everything as black objects, then project it in my terrain and object shaders with no depth checking. This is very fast, and has the benefit of having none of those depth errors you mention.

As a side benefit, you can apply these kind of shadow projections to anything, like grass or leaf sprites, etc.

To conclude, shadow/buffer/maps are the only way to go these days, most especially for outdoor environments.
i think i'll really use shadow mapping.
i found some more articles on the net, and they've convinced me finally :)

i read something about 'Dual-Textur Shadow Mapping', wich claims to be faster that to proof for every pixel if it's in the shadow or not.

but i've found no usefull tutorial about that or this advanced technique. do you know any? i've searched some hours now, but didn't find any tutorial for c++ with direct x, they are all for open gl -___-
i really need to understand that technique, and thats not very easy from the sdk o_O

[Edited by - SiS-Shadowman on April 17, 2006 7:53:37 PM]
Quote:Original post by Matt Aufderheide

and for outdoors i use a single render target, with no depth buffer, and just render everything as black objects, then project it in my terrain and object shaders with no depth checking. This is very fast, and has the benefit of having none of those depth errors you mention.



Do you have screenshots? How can that be correct? If I render myself from the point of view of the light and then project that black texture onto all shadow receiving objects without doing a depth compare, I will cast a shadow on myself and the terrain, when really I should be only casting the shadow on the terrain.
Well in this case of course it only works for casting the shadows onto things which dont themselves cast shadows. in many cases this is ok, because the main thing is to shadow the terrain, or things like grass, plants, etc, which may not need to cast their own shadows.

If you want everything to cast its own shadow AND recieve shadows, yes you need to do a depth comparison.

In my outdoor renderer, i want things like trees, buildings, and characters to cast shadows onto the terrain and the grass models and plants.

My way is just simpler and faster, and looks good in many cases. Its a question of quality vs speed as always :) (but doing a simple depth buffer render for one source light like a sunlight and then the depth comp is no big deal really, so it wouldnt be a lot slower..its up to you ..)


Interesting approach. Sounds basically like the old shadow polygon method hoisted up into image space to cope with non-planar terrain. And, of course, it makes simple blurry shadows simple.
Surfaces which typically show a lot of artifacts with shadow mapping are those which are perpendicular to the light direction. This makes terrain->terrain shadowing (i.e. terrain shadowing on itself) with shadow mapping quite tricky. It is entirely possible, but usually with biasing tweaks in the lighting calc that either push or pull the lit-unlit boundary around to hide the artifacts. Object->object and object->terrain work well though.

I've found the trickiest part in terrain rendering is making the terrain shadow dynamic objects, such as characters in a valley.

T

This topic is closed to new replies.

Advertisement