Turn a heightmap into a normal map for a game engine

Grayscale bumps don't light properly — engines want the purple normal map. Convert height to surface direction per pixel.

Tools used in this guide

The job

Heightmaps store how far a surface is raised; normal maps store which way it faces — engines use the latter for lighting. The conversion is a Sobel-style gradient per pixel: horizontal change → X, vertical → Y, flat → Z.

Heightmap in, purple out

Drop a grayscale heightmap (white = high, black = low). The normal map comes out in the standard tangent-space convention — RGB = XYZ remapped to 0–255, so flat surfaces are that lavender colour.

  • Strength scales the gradient — crank it for deep relief on stone, lower it for subtle fabric weave.
  • Check your engine's convention: this outputs OpenGL-style Y+ normal maps. DirectX wants Y flipped — invert the green channel downstream if your engine expects that.

Inputs and limits

Up to 40,000,000 pixels (~8K). Source doesn't have to be grayscale — luminance is computed — but clean single-channel input gives the cleanest normals.