Bump map

Textures often called Bump Maps, or Normal Maps are used to simulate three-dimensional details on a two-dimensional surface by manipulating its lighting.

Textures often called Bump Maps, or Normal Maps are used to simulate three-dimensional details on a two-dimensional surface by manipulating its lighting.

circle-info

Note: Static props using bump maps can not be lit per-vertex, except in <Counter-Strike: Global Offensive>arrow-up-right.

circle-info

Note: Bump maps cannot be used on decal textures, except in <Counter-Strike: Global Offensive>arrow-up-right.

Format

Each pixel in a bump map contains the (x, y, z) coordinates that define a normalizedarrow-up-right vectorarrow-up-right.

Because of this each color channel in a bump map has meaning:

Red

Horizontal facing (X axis).

  • 0 = left

  • 128 = forward or facing viewer

  • 255 = right

Green

Vertical facing (Y axis).

  • 0 = up

  • 128 = forward, or facing viewer

  • 255 = down

Blue

Height (Z axis).

  • 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.

circle-info

Note: Valve's "flat" bump map textures use RGB values of [120, 124, 248]

circle-exclamation

The three channels represent a normal vector for every pixel which represents the direction that the pixel is facing in 3D spaces. 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 smooth concrete sometimes has enough depth to it to make one worthwhile.

Creation

A bump map should be rendered in Tangent space and use vector dimensions X+ Y- Z+.

circle-info

Note: There are basically two sets of rules for normal maps: DirectX and OpenGL. They interpretation of green channels are opposite. Source takes the former. Thus, the green channel may need to be inverted depending on the software used to create it.

Programs

Various programs can automate the creation of bump maps, either by image analysis or by using 3D geometry the user pro

Bump maps as created by various programs.

2D tools

3D tools

Other

Conversion

In VTFEdit

When converting your texture:

  1. Choose your image format. Uncompressed formats like BGR888 are higher-quality than compressed formats like DXT1, but be wary of file size.

  2. 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.

circle-info

**Tip:**VTFEdit can automatically generate bump maps. See the bottom-right of the import screen.

In Vtex

  1. Save your normal map as a TGA. Give it a name that ends in _normal. The _normal at the end of the name will affect how Vtexarrow-up-right converts it. For the brick wall example, we would name the file brickwall_normal.tga.

  2. Add nocompress 1 and normal 1 to <texture filename>.txt in the same folder as your texture, then compile.

Implementation

See $bumpmap.

Last updated

Was this helpful?