"Today, future belongs to freedom, not to fear."
- Bill Clinton

Framework 4 (Last updated: October 25, 2019)
Framework 3 (Last updated: February 6, 2017)
Framework 2 (Last updated: October 8, 2006)
Framework (Last updated: October 8, 2006)
Libraries (Last updated: September 16, 2004)
Really old framework (Last updated: September 16, 2004)
Self shadowing bumpmapping
Saturday, September 27, 2003 | Permalink

Executable
Source code
SelfShadowBump.zip (1.1 MB)

Required:
Vertex shader version 1.1
Pixel shader version 2.0
This demo does self shadowing bumpmapping. Letting the bumps in the bumpmap cast shadows over the surface really adds a lot to the feeling of depth of bumpmaps. On the bad side of things is that it's not exactly for free, though not horribly expensive either. A horizon map is needed for every texture. The horizon map is a 3D texture of considerable size. For some textures you can get away with a fairly low res horizon map, for others you need a quite large one to get good results.
For the sky I've written a shader that animates some kind of cloudy Quake-looking sky by using a 3D noise.

All shaders are written in HLSL.

The demo should run on Radeon 9500 and up and GeForce FX series.

2003-10-11:
Updated to include a menu item to let you toggle self shadowing on and off.

2004-01-15:
Updated to support offset mapping too. This further adds to the depth feeling of the bumps. You can turn offset mapping and self shadowing off independently to see in what way they contribute to the final picture.
Note, don't extract this demo over the old version. Instead, remove the old demo first and then extract this demo. Otherwise you will get very odd results since it will use old stored horizon maps that doesn't fit this new build.

2004-01-28:
Updated with shadow mapping for global shadows. The shadow mapping is combined with the offset mapping to get the global shadows to fall realistically over the bumpy surface.