Submitted by , posted on 09 November 2002
Image Description, by
Here's a little technique I would like to share with ya'll:
This image is, of course, a terrain with bump mapping applied to it. The
technique needs dotproduct3 combining, cube maps, and environment mapping.
In only works for directional lights which makes it perfect for outdoors.
The technique goes like this:
1. Use texture coordinate generation to get the camera space normals u,v,w;
2. Use the texture transform matrix to rotate from camera space to world
space, and then to light space, which in this case is the sun.
3. Use a normalizing cube map to transform from u,v,w to r,g,b
4. Dotproduct3 with your normal map
5. Add in the ambient value with addsmooth. This will knock out some
shadows, but won't overbright as much as add. This is what addsmooth was
basically created for.
6. Modulate with the texture map.
This works for not just the ground, but everything that is "outdoors". It
can be done with one pass on the newer video cards of course. The image
here is two passes. You can also modulate a shadow map in after step 5 if
you're using those. You can also add in the diffuse after step 5 instead of
ambient if you are doing vertex lighting.