Shadows in heightmap?

How to make shadows in heightmaps(so that hills have shadows)

Just my guess the same way, you make shadows with any other object.

  1. Render the as scene as viewed from the light source.
  2. use the stincel buffer to create a shadow texture.
  3. Create the scene from the camara’s view and apply the shadow texture to the hight map.

Originally posted by runggu:
How to make shadows in heightmaps(so that hills have shadows)

Errrmmm what?

The shadow texture must be created with stencil buffer only once and then used every time I draw my scene?

You need to check out some examples of creating shadows, that would be more helpful for you.

try nehe.gamedev.net

Originally posted by runggu:
Errrmmm what?

only if the object and light do not change position. If the light or object moves then the shadow will also have to change to reflect the new position.

Originally posted by Ehm…:
The shadow texture must be created with stencil buffer only once and then used every time I draw my scene?

you should try to use lightmaps, search for some tutorials about terrain engine, heightmaps and lightmaps !

But aren’t stencil buffers non voodoo compatible?

If the hardware does not support it, then it will be rendered by the software.

Anyway the voodoo is an out dated video card anyway!!!

Originally posted by runggu:
But aren’t stencil buffers non voodoo compatible?

I checked Nehe’s Stencil buffer tut and i didn’t figured it out