Normal Map Workbench

Height map to normal map

Open a grayscale height map, set how tall white is, and download a tangent-space normal map in OpenGL or DirectX style. A 16-bit PNG is read at 16 bits, so smooth terrain and sculpt bakes don't come out stepped. Runs in your browser.

or
1 · Height (white = high)
2 · Normal map, OpenGL
3 · Lit in 3D (drag to move the light)
Filter
Height from

What the converter computes

For every pixel it measures how fast height changes to the right (dx) and toward the top of the image (dy), using the pixels around it. The normal is the direction perpendicular to that slope:

n = normalize(−dx · d, −dy · d, 1)

where d is the relief in pixels: strength × image width. The vector is stored as color with R = (x + 1) / 2, G = (y + 1) / 2, B = (z + 1) / 2, which is why a flat area is the familiar (128, 128, 255) lavender. DirectX output stores G as 1 − G.

FilterWeights across the slopeCharacter
Sobel1 · 2 · 1Common default, mild smoothing
Scharr3 · 10 · 3Most even response to diagonal slopes
Prewitt1 · 1 · 1Strongest averaging, softest result

Each kernel is scaled so that a straight ramp gives its exact slope. Our test script runs ramps, a hemisphere and a sine ridge through all three: ramps come out within 0.0001° of the true normal, the hemisphere within 0.03°.

Setting strength from real sizes

Strength is the height of the full black-to-white range as a percentage of the texture's width. If you know the real sizes, you can set it instead of guessing:

  • A texture covering a 2 m wide wall, where black-to-white is 1 cm of depth: 1 / 200 = 0.5 %.
  • A 30 cm tile whose grout is 3 mm deep: 0.3 / 30 = 1 %.
  • In Blender, displacing the same height map on a plane of width W with a Displacement node, Scale = strength × W (midlevel 0) gives geometry that matches this normal map.

Why 16-bit input matters

An 8-bit height map has 256 levels. On a gentle slope the height climbs one level every few pixels, so the measured slope flickers between zero and one step, and the normal map shows terraces. Browsers decode every PNG to 8 bits for display; this page reads PNG files with its own decoder so a 16-bit height map keeps all 65,536 levels.

Converting a color photo instead? Use the normal map generator, which estimates height from brightness and also makes AO and roughness.

Questions

Does white have to mean high?
That is the usual convention and the default here. If your height map is a depth map (black = high), tick Invert. Pick the channel if your height is stored in R, G or B of a packed texture.
Why does my normal map have stripes or terraces?
The height map is 8-bit, or was saved as 8-bit along the way. With 256 levels, a gentle slope climbs one level every few pixels, so the slope reads as zero, then one level, then zero again. Export height as 16-bit from your sculpting or terrain tool, or add 1–2 px of blur here to smooth the steps.
Which filter should I use?
They differ in how much they average across the slope direction. Sobel is the common default, Scharr keeps diagonal slopes more even, Prewitt averages most evenly. All three give the exact slope on a straight ramp, so strength means the same thing whichever you pick.