Sign in to follow this  
MattLatham

Casting shadows on an irregular surface

Recommended Posts

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???

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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])

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

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