Shadows in a RTS game
I am thinking about how I should do shadows in my RTS. From what I have read some people think stencil shadows volumes are better than PSM... Any commments on this? My issue is I would like to minimize having to make multipass rendering to do shadows due to the size of the terrain. Also if the terrain image is lets say 257x257 and you have a shadow map of equal size won't the shadow be very blocky due to the size is per vertex? And if you increase the shadowmap size to 1024x1024 on a terrain of 257x257 aren't you still going to have somewhat of a pixelated shadow?
Next topic on this idea is how about self shadowing hills and such? What is the best way to do that? Can you use a PSM or stencil shadow volume to self shadow the terrain? I just need some direction on what is correct way to go about this without much headache...
Thanks for any help.
Stencil shadows are pixel accurate, but they are very slow to compute compared to shadow maps. However, in the situation you're describing, the jaggies of the shadow map would be pretty much intolerable. Most terrain shadow algorithms do not use shadow maps or stencil shadows for this reason. There are a few articles on the terrain section of gamedev, and a few threads in the forums about terrain self-shadowing, which is how you would put shadows on the terrain. However, for making shadows for objects placed on the terrain, like a tree, player, etc, you could still use stencil shadows or shadow volumes. But for performance, you would have to be careful about what lights can cast shadows, and from what range they are active. It would probably not be advisable to use the sun as the shadow caster for these objects.
I'd really consider using a shadow map approach, for a few reasons:
Shadow rendering time would be constant, for any amount of objects on screen (could be a lot if its a rts?).
It's pretty easy to implement.
If done well there will be minimal jaggies - you can use perspective shadow mapping so the 'frustrum' of the light fits tightly around the view frustrum - basically so space on the shadow map is not wasted.
Shadow rendering time would be constant, for any amount of objects on screen (could be a lot if its a rts?).
It's pretty easy to implement.
If done well there will be minimal jaggies - you can use perspective shadow mapping so the 'frustrum' of the light fits tightly around the view frustrum - basically so space on the shadow map is not wasted.
Quote:Original post by stevenmarky
I'd really consider using a shadow map approach, for a few reasons:
Shadow rendering time would be constant, for any amount of objects on screen (could be a lot if its a rts?).
It's pretty easy to implement.
If done well there will be minimal jaggies - you can use perspective shadow mapping so the 'frustrum' of the light fits tightly around the view frustrum - basically so space on the shadow map is not wasted.
Exactly, in a RTS you can have 100's of units moving around and I need some kind of method to deal with that. And I still want to self shadow the terrain which I don't think you can do with PSM maybe I am wrong?
yes, you can do it with shadow maps, but it would be a rather unwieldy approach (involving saving the depth values of every vertex and such), you should either use the strider algorithm which is outlined in the game programming seciton of the articles iirc, or stencil shadows. As for units, i dont think the size of the terrain has anything to do with the size of the shadow map, unless of course you want per vertex resolution and the light is right above the map... First of all, if its a rts, why dont you just do a little blob shadow projected onto the terrain below? and second, if you MUST do a more accurate technique, why not just render each unit to a shadow map then apply it to the terrain? (depending on how many units you expect to be onscreen at any time, it would probably be acceptable)
hope that helps
-Dan
hope that helps
-Dan
errm, why when talking about 'shadow maps' are you discussing 'depth per vertex'... vertex depth doesnt come into it, the map is built from the z-value of each fragment
Well, to determine if a vertex should have the shadow map applied (if you were to attempt self shadowing) you need to check to see if it is deeper (from the light) than the shadow map depth
-Dan
-Dan
and again I say, errm... when you render with the shadow map you'll compare the outgoing fragment with the correct value in the shadow map to work out if its shadowed or not.
Again, this happens per fragment, not per vertex...
Again, this happens per fragment, not per vertex...
ok, but you dont need them, shadow maps basically give you self shadowing for free (well, not free but it just 'works' because of how the system works)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement