Sign in to follow this  
stanlo

Shadow algorithms recommendation

Recommended Posts

I need to impliment shadows into a simulation. The scene would be classified as an outdoor scene. The problem is mostly the requirements. I need it to run fast on low end computers. Maybe a semi recent labtop with an integrated video card. The camera is completely free to move anywhere in the scene. It needs to support point lights, spot lights, and directional lights. All light parameters are user specified. Things should self shadow. The ground will not be a simple plane. I won't self shadow the ground, but I can't get away with planar shadows at all. Some of the meshes might be very over tesselated. I don't know what meshes will be in the scene. Multiple shadow casters is not a requirement, but it's something I'd really like to have. The scene will contain few static occluders. This is kind of a silly question, I know. Of course I have my own ideas in mind, but I thought I'd shoot it out here to see if I could pick up any new ideas. [Edited by - stanlo on March 3, 2007 3:26:43 AM]

Share this post


Link to post
Share on other sites
What kind of content do you have in the scene?

If it was mostly static such as buildings and trees etc. then lightmaps would work fine and be fast seeing as they are precomputed.

If you are not looking for realistic shadows than just dropped blob shadows would be a fast way of doing them, although this may be taking the 'low end' requirement a bit too far.

Anyway, in terms of high quality dynamic shadows stencil shadows and shadow maps are the most widely used and generally recommendable form of shadows.

Still, it all depends on what's in the scene, what it's doing and how much quality you want.

Share this post


Link to post
Share on other sites

There isn't really a "correct" solution for this, just a toolbox of different solutions. What is right for you depends on your scenario.

Now, first off decent shadows don't come cheap, so implementing these on a low-end computer is anything but trivial, if you expect a healthy framerate.

If you want self-shadowing, projective shadows are out, and we're talking about either a type of shadow map, or stencils, but stencils generally plough through fillrate, so in reality you're probably looking at shadow maps.

Standard shadow maps suffer significant resolution problems, but if you can live with these, they're both fast & easy to implement. To solve the resolution problems, however, you either need a perspective method (trapezoidal or perspective shadow maps), or cascaded shadow maps.

Both perspective and trapezoidal shadow maps suffer their set of problems, but you can engineer your way around them. I do warn you, however, wrapping your head around the perspective equations can be tricky - the maths are a lot more complicated than standard shadow maps. The main problem area is debugging the results, I advise you to spend a substantial amount of time on your debugging tools in this area to visualize the shadows.

Cascaded shadow maps, however, are basically standard shadow maps, just with the frustum pyramid split into sections. It will generally be slightly more expensive, as there will be some overlap in the shadow casting, and you dynamically have to stitch the texturemaps together, which might also create some seams. But it is easy to implement, and easy to wrap your head around.

Good luck, and let us know how it goes.

Share this post


Link to post
Share on other sites
Quote:
Original post by Twincamtinman
What kind of content do you have in the scene?


The scene will consist of a lot of non moving dynamic objects, if that makes any sense. They need to be able to move, but most of them won't be going anywhere soon. I don't want to run a light mapper. This isn't really a 'game' I'm working on (so why am I posting on gamedev?! This didn't occur to me until after I made the OP [smile]). Thanks for the tips though.

I've implimented shadow maps a number of times before, and I don't have any problems with projective geometry. I guess what I'm really looking for is flexability over quality. I don't have infinite time to work on this, so I can't just impliment five different methods depending on the hardware I'm on. I'd rather have maybe two or one that are scalable somehow.

For high-speed & low-end, I was thinking about projected texture blobs. I'd miss out on the self shadowing (I can yell at the user to upgrade their hardware), but I don't know how I'd estimate the the blob size based off arbitrary geometry.

Thanks for the suggestions guys.

[Edited by - stanlo on March 3, 2007 4:23:08 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this