Casting shadows on an irregular surface

Started by
8 comments, last by Muhammad Haggag 19 years, 4 months ago
I am very new at the whole shadows thing, and all the examples I have seen deal with an object casting a shadow on a flat surface. That's not very usefull when you have surfaces that are irregular like cave walls. Can anyone help???
Advertisement
Look into shadow volumes. It will give you very nice results if you're willing to put the effort into it.
There are several shadow techniques, the ones that are generally considered most robust (in terms of that they cast shadows correctly under all or almost all circumstances) are shadow volumes (z-fail variety) and shadow maps. If you look at examples of these, even though they may just demonstrate casting on a flat surface, the algorithm itself if properly implemented is capable of casting shadows onto any arbitrary surface.

-Mezz
Quote:Original post by rjackets
Look into shadow volumes. It will give you very nice results if you're willing to put the effort into it.


While shadow volumes are the best shadow algorithm generally used, it is still extremely taxing. I implemented shadow volumes for an object that had >75000 vertices, not good.

If you have a simple model, SVs are applicable, otherwise steer clear.
I WISH SOMEONE WOULD FIX THE DAMNED LOGIN!
Quote:Original post by Alex Swinney
If you have a simple model, SVs are applicable, otherwise steer clear.

Doom 3 used shadow volumes, and you can't say its models are "simple" [smile].
You don't want to use shadow volumes with models having lots of holes and the like (trees, fences), and in general, you don't want to use them when they burn too much fillrate (you'll know when they'll do [wink])

Doom3's models are only like 5000 polygons or so, aren't they? They also limited the number of enemies to about 3 at once, so there were never more than maybe 70,000 polygons at one time.. Not everything used dynamic shadows either, I don't think.
Quote:Original post by MikeyO
Doom3's models are only like 5000 polygons or so, aren't they? They also limited the number of enemies to about 3 at once, so there were never more than maybe 70,000 polygons at one time.. Not everything used dynamic shadows either, I don't think.

IIRC, yes, the models where somewhere from 4000 to 10000. And that's, IMO, reasonable for humans/monsters at this time.

Quote:Original post by Coder
Quote:Original post by MikeyO
Doom3's models are only like 5000 polygons or so, aren't they? They also limited the number of enemies to about 3 at once, so there were never more than maybe 70,000 polygons at one time.. Not everything used dynamic shadows either, I don't think.

IIRC, yes, the models where somewhere from 4000 to 10000. And that's, IMO, reasonable for humans/monsters at this time.


Well, I should have specified, my model had 72000+ faces. With the shadow volume algorithm I had, each frame had to run through over 1.5 million iterations just to create and extrude the shadow volume.

If you keep the faces down to <= 1/2 of what I have you should be ok, that is unless you have more than one shadow volume being rendered at the same time. Then it will become a nightmare UNLESS you use shaders, much like the D3D demo uses. I love that demo...
I WISH SOMEONE WOULD FIX THE DAMNED LOGIN!
I found a shadow volume example but when I try to put one of my meshes into the program, it totally fragments the shadow. It really looks weird! Does anyone know where I can find a really good and really simple shadow volume tut/example?
Quote:I found a shadow volume example but when I try to put one of my meshes into the program, it totally fragments the shadow. It really looks weird! Does anyone know where I can find a really good and really simple shadow volume tut/example?

There are a lot of shadow volume samples on the web. A google would turn up a lot of results. There's one in the SDK (I assume you saw that), and there's another one at CodeSampler, and there's one at Booyah.

By the way, what kind of model did you throw at it? Shadow volumes have some limitations on the shape/type of model used.

This topic is closed to new replies.

Advertisement