Skip to content
NormalMap Gen On-device processing

FIELD NOTES / 04

Seamless Normal Maps Without Seams or JPEG Artifacts

Prepare repeatable photos and heightfields, compare Sobel and Scharr, and reduce edge seams, compression blocks and height banding.

Horizontal Sobel and Scharr weights and tangent normal normalization.
Horizontal Sobel and Scharr weights and tangent normal normalization.

Match slope as well as brightness

Move the tile by half its width and height with wrap enabled in your editor. The original border becomes a cross at the center. Fix the cross with a clone or blend that preserves the material pattern. Continuity means both sides agree in level and meet with a compatible slope. Matching the edge pixels alone can leave a visible crease. Render a two-by-two repeat and inspect it under grazing light; a seam hidden head-on can still stand out at a shallow angle.

Remove baked lighting before differentiation

Shoot or prepare a source with diffuse light and little glare. A broad exposure gradient becomes a permanent tilt in the generated normals; a cast shadow can turn a flat floor into a trough. Reduce that large-scale lighting gradient separately from material pores. Do not remove true large-scale relief by accident. When color differs from height, paint a grayscale mask or use actual scan data instead of assuming every bright patch is high.

Pick a kernel and judge the source

Sobel weights the center side samples twice as heavily as the corner samples; Scharr uses 10 versus 3 to improve directional consistency. Both can exaggerate input artifacts, especially JPEG blocks. Use a light preblur on a copy and lower strength before trying more sharpening. Wrap mode supplies neighbors across the edge; it will faithfully detect a discontinuity and cannot make an arbitrary photo seamless on its own.

Keep a higher precision master

For soft ramps or displacement keep a lossless 16-bit height master in your editor. Saving an existing 8-bit JPEG as 16-bit does not restore its tonal steps or remove compression. This studio's Canvas path exports 8-bit PNG, suitable for a quick test but not a substitute for a high-precision displacement bake. Avoid recompressing normal vectors to JPEG; review the engine's normal and mask compression at intended mip levels.

Frequently asked questions

Does wrapping fix non-matching edges?

No. Prepare the source borders so that levels and slopes continue across the tile before enabling repeat sampling.

When is Scharr preferable?

Try it on diagonal texture where a 3×3 Sobel result looks directionally uneven. It does not repair noisy input.

Does a 16-bit export fix banding in a JPEG?

No. Higher precision helps preserve new data; it cannot reconstruct information lost by a prior export.

Why do blocks appear only after normal generation?

Differentiation boosts small brightness changes. A JPEG block boundary that barely showed in color can turn into a visible orientation change.

Explore the field notes

Studio OpenGL vs DirectX PBR map guide