Unreal 5 – Automatic Landscape Material


Building a production-grade automatic landscape material in Unreal Engine 5: slope and height masks, triplanar projection, texture bombing, macro variation, Runtime Virtual Textures, and procedural foliage.


This project is a landscape material and environment demo built in Unreal Engine 5, developed following this Udemy course. The central concept is the automatic landscape material — a master material that applies different surface textures to a terrain automatically, based on the terrain’s own geometric properties, without requiring manual layer painting. The techniques it uses — slope masks, height masks, triplanar projection, texture bombing, macro variation — are the same ones used in production open-world environments at AAA studios.

You can watch the demo here: YouTube


The Problem: Manual vs. Automatic Landscape Texturing

Standard landscape texturing in Unreal uses layer painting: the artist manually paints which texture (grass, rock, dirt, snow) covers which area of the terrain. This gives precise control but has a fundamental scaling problem — a large open-world terrain has millions of surface points, and manually painting them all is impractical. It also creates maintenance problems: if the terrain is sculpted after painting, the painted layers no longer match the physical terrain shape.

An automatic landscape material solves this by reading the terrain’s geometric properties at runtime and computing which texture should appear at each point based on rules. A steep slope gets rock texture. A high elevation gets snow. Flat areas at low elevation get grass. The material applies itself correctly to any terrain shape without any painting, and updates automatically when the terrain is modified. This is the “automatic” in automatic landscape material — the distribution is data-driven, not artist-painted.


Landscape Creation in Gaea

The terrain itself is created in Gaea — a dedicated terrain generation tool — and imported into Unreal as a heightmap. Gaea’s node-based erosion and weathering simulation produces geologically plausible terrain shapes: realistic ridgelines, river valleys, eroded cliff faces, and talus slopes. The heightmap exported from Gaea drives Unreal’s Landscape component, which tessellates it into the world-space terrain mesh.

This Gaea-to-Unreal pipeline is the standard approach for open-world terrain in production: dedicated terrain tools produce better results than Unreal’s built-in sculpting tools for large, complex terrain shapes, and the heightmap import preserves all the detail the terrain tool generated.


The Master Material Architecture

The landscape material is a single master material that encapsulates all surface variation logic. Its inputs are the terrain’s own geometric data — world position, surface normal, height — and its output is the final surface appearance at each point. The material is divided into functional layers that each contribute to the result:

Base layers define the surface textures themselves — grass, rock, dirt, snow — each with its own Base Color, Normal, Specular, and ORD (Occlusion, Roughness, Displacement) texture maps. The ORD packing combines three grayscale channels into a single texture, reducing the number of texture samples required and improving performance.

Mask layers determine where each base layer appears, computed from the terrain geometry. These are the intelligence of the automatic material.


Slope Mask and Transition Slope Blend

The slope mask computes how steep the terrain is at each point by reading the surface normal’s Z component — a perfectly horizontal surface has Z=1.0 (normal pointing straight up); a vertical cliff face has Z=0.0. Thresholding and remapping this value produces a grayscale mask: white where the terrain is flat, black where it’s steep. Rock texture is applied where the slope mask is dark (steep terrain); grass where it’s bright (flat terrain).

The Transition Slope Blend controls the softness of this transition. A hard threshold produces a sharp, unrealistic line between grass and rock; a soft blend with a configurable transition width produces a natural-looking gradient where grass gradually gives way to rock on steepening slopes. Getting this transition width right is one of the main tuning tasks — too sharp looks procedural, too soft looks muddy.


Height Mask and Snow

The height mask reads the terrain’s world Z position — its elevation — and uses it to determine where snow appears. Above a configurable elevation threshold, a snow texture blends in over whatever surface is beneath it. The snow mask also considers slope — snow accumulates on flat and gently sloped surfaces, not on steep cliff faces where it would slide off. This is achieved by multiplying the height mask with the inverted slope mask: snow appears where the terrain is both high AND relatively flat.

The combination of slope and height masks produces the characteristic visual language of alpine terrain: grassy lowlands, rocky midslopes, snow-capped peaks — all computed automatically from the terrain geometry.


Triplanar Projection

As covered in the weather system project, triplanar projection eliminates the texture stretching artifact on steep terrain by sampling textures from all three world-space axes and blending based on surface normal. In the landscape material, triplanar projection is applied specifically to the rock texture — which appears predominantly on steep surfaces where standard UV mapping would produce visible stretching. Grass and snow, appearing on flatter surfaces, can use standard UV mapping without visible artifacts.


Texture Bombing and Macro Variation

Two techniques work together to eliminate the tiling artifact — the visible repetition pattern that appears when a texture tiles across a large surface:

Texture bombing samples the texture at multiple randomly offset UV positions and blends between them, breaking the regular tiling grid into an irregular distribution that reads as non-repeating at normal viewing distances.

Macro variation adds a large-scale color variation layer over the surface — a low-frequency noise pattern that slightly darkens or lightens areas across the terrain. This breaks the uniformity of texture tiling at distances where texture bombing’s UV-level randomization is no longer visible. Together, the two techniques produce a surface that reads as continuous and natural at all distances, from close up to horizon.


Runtime Virtual Texture

Runtime Virtual Textures (RVT) solve the visual discontinuity between landscape surfaces and objects placed on them. Without RVT, a rock sitting on the terrain shows a hard edge where the terrain texture meets the rock’s base — they exist as separate materials that don’t communicate. With RVT, the landscape material writes its appearance into a shared virtual texture, which static mesh actors (rocks, trees, debris) can sample to blend their base with the terrain material beneath them. Rocks on a snow-covered slope show snow at their base; rocks on grass show grass. The objects feel embedded in the terrain rather than placed on top of it.


Landscape Grass Type and Auto Foliage

The foliage system uses Unreal’s Landscape Grass Type asset to define procedural foliage that spawns automatically based on the landscape material’s layer weights. Where the grass layer is active, grass and flowers spawn. Where the rock layer is active, no grass spawns. The foliage density, scale variation, and randomization are all configured in the Grass Type asset.

Fade In/Out controls are applied to the foliage — grass and small flowers fade out at a distance to avoid rendering millions of small meshes at range, and fade back in as the camera approaches. This distance-based culling is essential for performance; rendering dense foliage to the horizon is prohibitively expensive on any hardware.

Camera depth fade applies a similar principle to individual grass instances — blending them out as they approach the maximum render distance to avoid a hard pop-in line where foliage suddenly appears.


Reflection

The automatic landscape material is one of the most technically demanding shader projects in this series, and one of the most directly applicable to production work. Any open-world game with outdoor environments needs a solution to the terrain texturing problem, and the approach here — geometry-driven automatic layer distribution, combined with tiling-suppression techniques and RVT for object blending — is the industry-standard answer.

The material graph complexity is significant, but the conceptual structure is layered and readable: geometric masks determine which surface appears where, anti-tiling techniques ensure those surfaces read well at all distances, and the RVT and foliage systems extend the material’s influence beyond the terrain mesh itself into the entire environment. Understanding each layer independently, then understanding how they compose, is the right way to approach complex material graphs of this kind.

Leave a comment

Create a website or blog at WordPress.com

Up ↑