"Nostalgia isn't what it used to be."

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

Source code
SelfShadowBump.zip (1.1 MB)

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.

Updated to include a menu item to let you toggle self shadowing on and off.

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.

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.