Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Roquqkie

Shadow casting on a terrain

This topic is 5896 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Im currently working on a terrain-engine. At this point I can load and render animated MD3 models and a multitextured terrain. I´ve read a lot of tutorials explaining how to cast shadows on a plane (usally the xz-plane), but I want to cast shadows from my models onto my terrain! Please don´t flame me, just help me :D Best regards Roquqkie

Share this post


Link to post
Share on other sites
Advertisement
Well, there is a tutorial on Nehe about casting shadows, so you could look at that. Also, there are several articles on the nVidia developers site, so that should also be your first port of call.

Death of one is a tragedy, death of a million is just a statistic.

Share this post


Link to post
Share on other sites
Well, if you want to cast shadows on terrain and not onto an even plane you should use shadow mapping or stencil shadow volumes.

Gero

Share this post


Link to post
Share on other sites
Gerogerber... could you describe the theory behind shadow-mapping and stencil shadow volumes???

Thanx m8

-Roq-

[edited by - Roquqkie on May 30, 2002 11:35:19 AM]

Share this post


Link to post
Share on other sites
If you actually bothered to like at the sites I mentioned, you would have found the answers to alot of your questions. There are detailed papers on shadow mapping, so go and have a look, they will tell you much more than what a single person can tell you here.

Death of one is a tragedy, death of a million is just a statistic.

Share this post


Link to post
Share on other sites
Most shadow mapping on terrain (in my experience) is precalculated beforehand, saved as a texture, and multitexture the terrain texture and the shadow map.

Share this post


Link to post
Share on other sites
I think he means for the model to cast a shadow onto the terrain, but you can store static shadows for static objects in the texture. That brings up another point -- how do you avoid adding shodows where there are already shadows? You don''t want a player casting a shadow on the ground if he''s in the shadow of the hill already. Any suggestions on how to avoid that if you have shadows stored in the texture? Motocross Madness 2 avoided overlapping shadows...

Share this post


Link to post
Share on other sites
well, if you are standing in teh shadow of say a hill it implys you are behind the hill, therefore a Ray cast from the light to your postion would conferm this (myabe a couple of them if you want to detect if the head is above or whatever), and then you just turn off or on the shadowing code as needed

Share this post


Link to post
Share on other sites
Well, thx all!
But I´ve sticked to "Shadow Mapping" as Gerogerber and Python_Regious told me to. This technique seems suitable because it is independent of the world around the model that cast the shadow. I just can''t figure out how to implent it...
I have managed to store the depth-buffer from the lights point of view as a texture, but I don''t know what to do next!?
I´ve read that the next step is to test each fragment in the newly created texture againts the vertices in model-space from the cameraes point of view, but Im not sure!?

-Roq-

Share this post


Link to post
Share on other sites
[rant]Why do people bother replying just to post links to sites which MIGHT just possibly have something relevant. The old "There might be something on nehe" response. As the poster said, he'd already found lots of resources on PLANAR shadowing. What he wants help with is _dynamic_ terrain shadow generation (not static shadows, Neosmyle). Banding about terms such as "stencil shadows" without bothering to explain their meaning (probably because you don't know yourself) is also unhelpful.[/rant]

Now, in answer to the original question (now there's an original idea ), I recently found a page linking to several methods, of varying complexity for dynamically shadowing a terrain here. In particular, the terrain self-shadowing method described in this article looks like it would be very effective when used with low res heightmaps.

____________________________________________________________
www.elf-stone.com

[edited by - benjamin bunny on May 31, 2002 8:59:49 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!