From Valve Developer Community
Textures often called Bump Maps, or Normal Maps are used to simulate three-dimensional details on a two-dimensional surface by manipulating its lighting. The process is known as Normal Mapping.
Because of this each color channel in a bump map has a meaning:
- Horizontal facing (X axis)
- 0 = left
- 128 = forward, or facing viewer
- 255 = right
- Vertical facing (Y axis)
- 0 = up
- 128 = forward, or facing viewer
- 255 = down
- Height (Z axis). Valve's "flat" bump map textures use 248.
- 0 = facing 'in' to the texture, away from the viewer. This is a 'bad' value. Anything under 128 means that the surface should be facing away from the player, which is not possible.
- 128 = maximum depth capable of receiving dynamic light. It's a bad idea to go under this.
- 255 = facing 'out' of the texture towards the viewer.
The three channels represent a normal vector for every pixel which represents the direction that the pixel is facing in 3D space. This allows the engine to generate shadows and highlights on a two-dimensional surface, or give a 3D model more detail.
A bump map is largely useless for really flat surfaces like smooth concrete or metal, but even rough concrete sometimes has enough depth to it to make one worthwhile.
A bump map should:
- Be at the same resolution as the albedo/s it is to be used with.
- Be stored in an uncompressed format (see Conversion). Note that valve saves all of their normals/bumpmaps in a compressed format, uncompressed formats should only be used when strong artifacts occur or becomes extremely noticeable!
- Be rendered in Tangent space.
- Use vector directions X+ Y- Z+.
Various programs can automate the creation of bump maps, either by image analysis or by using 3D geometry the user provides.
- Photoshop or Paint Shop Pro
- The GIMP
- 3D Studio Max
- NVIDIA Melody
- Cinema 4D
- CrazyBump: Produces some very good normal maps. Some of them can be argued as almost having the same depth as a parallax map.
- Filter Forge: Can generate normal maps for its filters and external images.
- MindTex: A cheaper alternative to CrazyBump. Also produces high-quality normal maps.
- ShaderMap: A free alternative to CrazyBump.
- SSBump Generator 5.3: Another free, open source alternative to CrazyBump that generates Self Shadowed Bump Maps as well as normal maps.
- Normal2dudv: a third party tool for converting bump maps to Dx8-friendly du/dv maps.
When converting your texture:
- Choose BGR8888 or BGRA8888 (if your texture has an alpha channel) as your image format.Tip:You can sometimes get away with DXT compression. More specifically, normal maps with DXT compression do not work in the Ep1 engine. They do however work in the later versions of the Source engine.
- Check the "Normal map" box in the texture's flags list after the import is complete. It's about 1/5 of the way down the list.
- Save your normal map as a TGA in the same resolution as the original texture. Give it a name that ends in _normal. The _normal at the end of the name will affect how Vtex converts it. For the brick wall example, we would name the file
normal 1to <texture filename>.txt in the same folder as your texture, then compile.
$ssbump: creation and usage of Valve's new self-shadowing bump maps.
- An old article that explains normal mapping quite well.
- Material Creation