The 3D Handbook
Key term

Height blending

Blending two materials by comparing their height maps as well as the blend mask, so sand fills the gaps between stones before it covers their tops; the maths in plain words, contrast, and landscape layers.

texturingmaterialsterrain

Height blending mixes two materials using their height maps as well as a blend mask. Instead of fading one material evenly into the other, the material that is "higher" at each pixel shows first. Sand settles into the cracks between cobbles while the cobble tops stay clean; moss grows in the low spots of a stone wall first.

Brian Lesiangi sums it up in one line: "It blends 2 textures (or more) using their height information" (ArtStation blog: Real-time materials).

#Why it matters

A plain linear blend multiplies each texture by its weight and adds them together. Andrey Mishkinis points out that this looks wrong on terrain: the stones "look evenly soiled by sand", which does not happen in the real world (Game Developer: Advanced Terrain Texture Splatting). Height blending makes transitions follow the shapes in the textures, so a blend painted with a soft brush still produces crisp, believable borders.

It is commonly added to vertex paint materials and landscape layers.

#The maths in plain words

Take two materials, A and B, each with a height map from 0 (low) to 1 (high), and a blend mask that says how much of B you want (from vertex colour, a painted layer, or a texture).

  1. Add the weight to each height. A's score is its height plus its weight (1 − mask). B's score is its height plus its weight (mask).
  2. Find the winner. Whichever score is higher is on top at that pixel.
  3. Soften the edge. Picking only the winner gives jagged pixel edges. So keep every material whose score is within a small depth of the highest score, and blend those by how far above the cut-off they are.

Mishkinis' version uses a depth of 0.2; in his words, "we will take several pixels in depth instead of one and blend them" (Game Developer: Advanced Terrain Texture Splatting):

float3 blend(float4 texture1, float a1, float4 texture2, float a2)
{
    float depth = 0.2;
    float ma = max(texture1.a + a1, texture2.a + a2) - depth;
    float b1 = max(texture1.a + a1 - ma, 0);
    float b2 = max(texture2.a + a2 - ma, 0);
    return (texture1.rgb * b1 + texture2.rgb * b2) / (b1 + b2);
}

Here the height map lives in each texture's alpha channel, and a1 and a2 are the blend weights (Game Developer: Advanced Terrain Texture Splatting).

A graph across a surface from left to right. The blend mask rises linearly from material A to material B. Two curves show the scores: a bumpy dark curve for cobblestones (height plus their weight) and a smoother orange curve for sand (height plus its weight). Below the graph, a result strip shows sand appearing first in the dips between stones and only covering the stone tops towards the right.
Each material's score is its height plus its blend weight. Where the orange sand score beats the stone score, sand shows. The linear mask moves smoothly, but the result follows the shape of the stones.Diagram by the handbook author

#Worked example

At one pixel the mask is 0.5. A stone top has height 0.9; the sand there has height 0.3. Stone scores 0.9 + 0.5 = 1.4, sand 0.3 + 0.5 = 0.8. Stone wins clearly.

In the gap between two stones, the stone height is 0.1. Stone now scores 0.6 and sand 0.8, so sand wins. The mask value is the same, but the result differs because the heights differ.

#Sharpness and contrast

The depth value (or "contrast", depending on the tool) controls how hard the transition is. A small depth gives sharp, almost cut-out edges; a large depth fades back towards a linear blend.

Unreal's HeightLerp material function exposes this as inputs (Unreal Engine documentation: Texturing Material Functions in Unreal Engine):

  • Height Texture: "The heightmap used for the lerp operation."
  • Transition Phase: "The value which defines the region of the heightmap where transition takes place." Feed your vertex colour or painted mask here.
  • Contrast: "Applies a contrast boost to the heightmap using the CheapContrast function."

Its outputs include the alpha with and without contrast, so you can reuse the same mask for colour, roughness and normals (Unreal Engine documentation: Texturing Material Functions in Unreal Engine).

#Landscape layers

Terrain is where height blending is used most. In Unreal's Landscape Layer Blend node, LB Height Blend "is the same as LB Weight Blend, but also adds detail to the transition between layers based on a height map" (Unreal Engine documentation: Landscape Materials in Unreal Engine).

Epic describes one problem. Where several height-blended layers overlap, a spot can end up with no layer contributing, so "black spots can appear", and normal map blending makes it worse (Unreal Engine documentation: Landscape Materials in Unreal Engine). Their fix is to switch one layer, such as soil, to LB Alpha Blend, or repaint the area with a layer that has a non-zero weight (Unreal Engine documentation: Landscape Materials in Unreal Engine).

#Common mistakes

  • Flat or noisy height maps. The blend can only follow shapes the height map has. A height map with no clear high and low points gives a linear-looking blend.
  • Heights on different scales. If one material's heights sit around 0.8 and the other's around 0.2, the first will win almost everywhere. Level them first.
  • Too much contrast. Very sharp transitions alias and shimmer at a distance.
  • Only blending base colour. Use the same alpha for roughness and normals, or the borders will look painted on.
  • Black spots on landscapes from overlapping height-blended layers (Unreal Engine documentation: Landscape Materials in Unreal Engine).

vertex painting and blending · height and displacement maps · terrain and landscapes · tileable materials · detail maps and macro variation · master materials and instances

#Further reading and watching

Part of Manning's series on a four-way height-blended material; the technique carries over directly to UE5. Watch on YouTube

References

  1. Brian Lesiangi · Real-time materials · ArtStation blog, 2021 · article · accessed 2026-10-21
  2. Andrey Mishkinis · Advanced Terrain Texture Splatting · Game Developer, 2013 · article · accessed 2026-10-21
  3. Epic Games · Texturing Material Functions in Unreal Engine · Unreal Engine documentation · docs · accessed 2026-10-21
  4. Epic Games · Landscape Materials in Unreal Engine · Unreal Engine documentation · docs · accessed 2026-10-21
  5. Ryan Manning · UE4 Height Blended Materials 3-Part Series · Epic Developer Community, 2022 · video · accessed 2026-10-21

Also consulted

Last updated 2026-10-22