Sign in to follow this  
Eitsch

Many shadows/projectiveTextures

Recommended Posts

i have a terrain and i need shadows of trees on the terrain. now i have a projective texture projected to the terrain but i need many projected textures. i have googled around but i did not find anything really appropriate. i could use stencil based shadows but i suppose it is to slow. i could render every tree with the triangle above it and project the texture on the second terrain with disabled depth test... i think everything here is nonsense... --> what is the fasted way to cast shadows of trees on terrain?

Share this post


Link to post
Share on other sites
Since trees dont move (Hey I dont know if your game is lumberman jack - chop them trees down!!), the easiest and fastest way to get this sort of terrain shadowing is to use lightmapping. Basically, after creating your terrain and placing all of your trees, you would run the geometry through a lightmapper, that is basically a ray-casting engine. It will create lightmap textures that you can use to modulate your diffuse textures, providing nice-looking, very cheap (resource/speed-wise), accurate shadows. Naturally, this only works for static lighting, and creating a light mapper is no small task.

Links:
Here's a good tutorial on how to write a Radiosity engine. (Lightmapper)

I've never even heard of this project before, but it looks quite promising!RadiosGL

And finally, if you dont want to worry about lightmapping, here is a sweet, easy-to-use tool, with a builtin lightmapper: DeleD

Share this post


Link to post
Share on other sites
thanks...unfortunatly i have lumberjack avtivities. how long does it take to regenerate the lightmap? i only want to regenerate it when a tree disappears.


more info: it is a strategygame like age of empires.

nice links thanks. other ideas?

Share this post


Link to post
Share on other sites
The simple (and not very beautiful) method is to create a single texture that covers the whole terrain (you could use as small as a 512x512 texture, but the larger the texture the less jagged the shadow), and then render into this texture from the point of view of each light, then use this texture as a shadow map for the terrain (probably in a second texture unit).

The nicest way that will run on all hardware is to render volume (stencil) shadows, but only for the trees that are currently in view (need a good culling system to save on unnessary shadows being drawn).

The really nice way (but you need a very new video card) is to use GPU shadow textures (they go under a variety of names, not always meaning the same technique: shadow maps, shadow buffers, etc.), again, only for the trees in view.

Whichever way you pick, google is a veritable goldmine of information on all of these.

Hope this helps,
SwiftCoder

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