Skip to main content
Version: Next (dev)

Layered Materials

A layered material stacks surfaces on top of each other: mud as the base, water collecting in the mud's low parts, snow on everything that faces up. Each layer has its own textures (or borrows another material, or is built from nodes of your own) and a mask that says where it shows. Layers can mix by height, so a layer first fills the low parts of the layers below it and its own high parts, the way snow settles between stones instead of fading over them.

A layered material with mud, puddles and snow layers in the material editor

Every layer is a complete OpenPBR surface. Besides base colour, metalness, roughness and normal it can add lobes: a clear coat on wet puddles, subsurface scattering in snow, fuzz on dust, transmission for ice.

You edit the stack in the Layers panel of the material editor. The editor turns the stack into visual shader nodes that feed the OpenPBR output, so a layered material compiles, previews and ships like any other visual shader material. There is no extra layer system at runtime.

When to Use Layered Materials​

Use a layered material when a surface is a mix of a few materials that you already have, or could paint as textures:

  • terrain-like ground and rock: dirt, gravel, grass, snow, puddles;
  • weathering: rust, dust, moss or dirt over a clean base;
  • wet, frozen or coated versions of an existing material.

The Layers panel gives you masks, height blending and lobes without wiring a single node, and every change shows on the preview right away. Your textures and values stay in one list per layer instead of being spread across a graph.

Build a visual shader graph by hand instead when the material is not about mixing surfaces: animated or procedural effects, unusual lighting, or anything that needs custom math. You can also combine both: a layer whose source is Graph takes its values from your own nodes, and a stack can be detached into plain graph nodes when you outgrow the panel. Graph authors can also use the material layer nodes directly.

Turning on Layered Mode​

There are two ways to give a material a layer stack:

  • set Shader Mode to Layered in the material's properties, or
  • open the Layers tab and click Add Layer Stack.

The Layers panel of a material without a layer stack

In Layered mode:

  • the Layers panel opens as a tab next to Properties and comes to the front;
  • the Visual Shader panel shows the graph that the stack builds;
  • the material's own property list leaves out the layer textures, because you set those on the layers.

A material in Visual Shader mode can also have a layer stack. Its Layers panel stays open next to the Properties.

The Layers Panel​

The Layers panel with a single locked base layer

From top to bottom, the panel has a toolbar, the list of layers, a cost line, the Add Lobe button, and the properties of the selected layer.

Toolbar​

ButtonWhat it does
+ LayerAdds a layer above the selected one. Pick the source from the menu: Textures layer, From a material or From the graph (Make Layer). A new layer starts with a Slope mask, so it shows on surfaces that face up.
DuplicateCopies the selected layer, mask and lobes included, and names the copy "name Copy".
Move UpMoves the selected layer up, over more layers.
Move DownMoves the selected layer down. The base layer always stays at the bottom.
RemoveRemoves the selected layer. The base layer cannot be removed.
More (...)Copy layer, Paste layer above and Detach stack to graph.

The + Layer menu: Textures layer, From a material, From the graph (Make Layer)

A stack holds at most 8 layers. The Add and Duplicate buttons are disabled when it is full.

The More menu: Copy layer, Paste layer above, Detach stack to graph

Copy layer and Paste layer above work across materials: copy a layer in one material, select a layer in another material, and paste. The pasted layer goes above the selected one, with its textures, mask and lobes. Pasting into a material without a layer stack creates the stack.

Layer Rows​

Layers are listed top first: the top layer covers the layers below it. Each row shows, from left to right:

  • Visibility (eye icon): hides or shows the layer. A hidden layer is left out of the shader and costs nothing.
  • Swatch: the layer's base colour texture, the thumbnail of its linked material, or its tint. Graph layers show a graph icon.
  • Name and description: the second line names the blend mode, the mask terms (for example Height blend, Slope x Noise), linked or graph for those sources, and the lobes the layer adds (+ Coat). A layer without mask terms reads everywhere.
  • Mask thumbnail: the layer's mask drawn on a sphere, white where the layer shows, with the sphere's up at the top of the thumbnail. Click it to show the mask on the preview instead of the material; click it again to go back.
  • Opacity: the layer's opacity as a percentage.
  • Layer button (right end): shows only this layer on the preview. Click it again to go back.

While the preview shows a mask or a single layer, a line under the cost says so, for example "The preview shows the mask of Snow. Click its thumbnail again to stop."

The Base Layer​

The bottom layer is the base layer. It sits under a divider, shows a lock icon instead of the eye, has no mask and no opacity, and always covers the whole surface. It cannot be hidden, moved or removed. Every other layer is drawn on top of it.

The Cost Line and Meter​

Under the layers the panel shows what the stack costs:

3/3 layers 8 textures 8 samples per pixel [meter]
  • layers: how many layers are shown, of how many in the stack;
  • textures: the textures the visible layers use, mask textures included;
  • samples per pixel: how many texture reads each pixel needs. A textured layer reads up to 4 textures (base colour, normal, ORM, height), and 3 times as many with Triplanar projection. Each Texture mask term adds one.

The meter on the right fills up as samples grow. It turns amber above 12 samples per pixel, where the material starts to get expensive on lower-end GPUs. The triplanar showcase material is an example: two triplanar layers use 24 samples.

The line below lists the lobes in use (Lobes: Coat, Subsurface), or "Base surface only, no extra lobes". Lobes add shading work but no texture samples. Lobes that change how the whole material is drawn add a warning here (see Transmission and Thin Film).

To keep a layer around without paying for it, hide it with the eye icon. Setting its opacity to 0 still costs its samples.

Layer Sources​

Every layer gets its surface from one of three Source settings.

Textures​

The layer has its own texture slots and values:

PropertyDescription
Base Color TextureThe colour of the surface.
Normal TextureThe normal map.
Orm TextureOcclusion in red, roughness in green, metalness in blue.
Invert OcclusionFlips the occlusion channel, for textures that store cavity (dark is open) instead of occlusion. Shown when an ORM texture is set.
Invert RoughnessFlips the roughness channel, for gloss or smoothness maps (bright is smooth).
Invert MetalnessFlips the metalness channel.
Height TextureThe height map that height blending compares.
Height ContrastScales the height around 0.5, so that height maps with different ranges blend alike. Default 1.
ProjectionMesh UV 1, Mesh UV 2, or Triplanar (World): projected along the world axes, for surfaces without good UVs. Triplanar reads every texture three times.
TilingHow often the textures repeat: per UV unit, or per metre with Triplanar.

An empty slot is not sampled. Without a base colour texture the layer uses Tint as its colour; without an ORM texture it uses Metalness and Roughness as values; without a normal map it is flat; without a height map its height is 0.5. A layer with no textures at all is a cheap way to add a flat colour, like the dark water of a puddle.

The Surface section applies to every source:

PropertyDefaultDescription
TintWhiteMultiplies the base colour, or is the colour without a texture.
Metalness1Scales the ORM texture's metalness, or is the metalness without one.
Roughness1Scales the ORM texture's roughness, or is the roughness without one.
EmissionBlackThe colour the layer emits.

Material​

With Source set to Material, pick an OpenPBR Surface material as the Linked Material. The layer uses that material's textures, values and lobes; the layer's Tint and scales still apply on top. When you edit the linked material, every layered material that uses it updates.

A linked layer named Rock with Source set to Material and a linked material; the cost line rises to 12 samples per pixel

A linked layer takes its lobes from its material, so Add Lobe is disabled while it is selected.

Graph​

With Source set to Graph, the layer's values come from a Make Layer node in the material's visual shader graph. Its inputs are the inputs of the OpenPBR output, with the same names, plus Height. Wire your own nodes into any of them: a procedural pattern, a scrolling texture, a colour that depends on the vertex colour, and so on. Inputs you leave unconnected keep their default values.

A graph layer and its Make Layer node in the visual shader editor

Graph layers show a graph icon as their swatch and graph in their description. Their mask, blend and opacity are still set in the Layers panel.

Blending​

Every layer except the base has a Blend section and a Mask section.

Blend Modes and Opacity​

PropertyDefaultDescription
BlendHeightHeight or Mask.
Opacity1Multiplies the mask. 0 hides the layer's effect, but not its cost.
Depth0.1Height blend only: how far apart in height the two surfaces mix. Small values give sharp edges, large values soft ones.
Height Offset0Height blend only: moves the layer up (above the layers below) or down (into their gaps).
  • Mask mixes the layer over the layers below by its mask, like painting with a soft brush. Use it for stains, dust, paint and decals.
  • Height raises the layer by its mask and compares its height with the height of the layers below. Within Depth of each other the two surfaces mix; otherwise the higher one wins. As the mask grows, the layer first fills the low parts of the layers below and shows on its own high parts. Use it for surfaces that settle into each other: snow, sand, water, moss.

A negative Height Offset pushes a layer into the gaps of the layers below. That is how the puddles in the mud showcase stay in the low parts of the mud.

Every value of a layer blends this way, lobes included: a coat on the puddles fades in and out with the puddles' mask.

Masks​

A layer's mask is a list of up to 4 terms. Each term gives a value from 0 to 1 and combines with the terms before it. A layer without terms shows everywhere, times its opacity.

Each term appears as a numbered entry in the layer's Mask section. Type Mask into the property filter to show only the mask:

The snow layer with a Slope x Noise mask, its properties filtered to the first mask term

Term propertyDescription
SourceWhere the value comes from, see below.
ChannelRed, Green, Blue or Alpha: the channel that the Vertex Colour and Texture sources read.
TextureThe mask texture, for the Texture source. Adds one texture sample per pixel.
Noise ScaleNoise source: how many noise cells span one UV unit. Default 8.
CombineHow the term combines with the terms before it: Multiply, Add, Subtract, Max or Min. Ignored on the first term.
ContrastScales the value around 0.5: above 1 sharpens the edge of the term, below 1 softens it. Default 1.
BiasAdded after Contrast: positive values grow the area where the term is 1, negative values shrink it. From -1 to 1.
InvertFlips the shaped term: 1 becomes 0 and 0 becomes 1.
SourceValue
Slope1 on surfaces that face up, 0.5 on vertical surfaces, 0 on surfaces that face down. Raise Contrast to keep it to the tops.
NoiseFractal noise on the UVs. Breaks up straight mask edges.
Vertex ColourA channel of the mesh's vertex colour, for masks painted on the mesh.
TextureA channel of a mask texture.
Height Below1 in the low parts of the layers below. Use it to fill cracks and gaps.
Constant1 everywhere: the layer's opacity alone decides.

A few combinations that work well:

  • Slope x Noise (Multiply): snow or dust on top, with a broken edge.
  • Slope, then Noise with Max: snow on top plus patches on the sides.
  • Noise x Height Below: dirt that collects in the gaps of the layer below.

Click the row's mask thumbnail to check a mask on the preview, white where the layer shows.

Lobes​

Add Lobe adds an OpenPBR lobe to the selected layer. The lobe's values appear as a new section in the layer's properties; turn off the lobe's switch at the top of that section to remove it. Each lobe can be added once per layer, and lobes that are already on the layer are disabled in the menu.

The Add Lobe menu with Coat greyed out because the layer already has it

After you add a lobe, the cost area lists it (Lobes: Coat) and the row description gains + Coat. Type the lobe's name into the property filter to jump to its section:

The snow layer with a Coat lobe, its properties filtered to the Coat section

Lobe values blend between the layers like the base colour does. A lobe that no visible layer adds is left out of the shader and costs nothing.

Specular​

Changes the strength and colour of the layer's reflections. The roughness stays the layer's own.

PropertyDefaultDescription
Specular Weight1Strength of the specular reflection, 0 to 1.
Specular ColorWhiteTints the reflection.
Specular IOR1.5Index of refraction, 1 to 3. Higher values reflect more.

Anisotropy​

Stretches the highlights along the surface's tangent, as on brushed metal.

PropertyDefaultDescription
Anisotropy Amount0.5How much the highlights stretch, 0 to 1.
Anisotropy Rotation0Direction of the stretch. 0 to 1 is a full turn.

Coat​

A clear coat over the layer: lacquer, varnish, or a film of water.

PropertyDefaultDescription
Coat Weight1How much coat there is, 0 to 1.
Coat ColorWhiteTints the light that passes through the coat.
Coat Roughness0.05Roughness of the coat. Low values give a sharp, wet reflection.
Coat IOR1.6Index of refraction of the coat, 1 to 3.
Coat Darkening1How much the coat darkens and saturates the surface beneath it, as wet surfaces do.

Fuzz​

A soft sheen at grazing angles: dust, velvet, frost.

PropertyDefaultDescription
Fuzz Weight1How much fuzz there is, 0 to 1.
Fuzz ColorWhiteColour of the sheen.
Fuzz Roughness0.5How spread out the sheen is.

Subsurface​

Light that enters the layer and scatters inside it: snow, wax, skin.

PropertyDefaultDescription
Subsurface Weight1How much light scatters below the surface, 0 to 1.
Subsurface ColorLight greyColour of the scattered light.
Subsurface Radius1How far light travels inside, 0 to 10.
Subsurface Radius Scale(1, 0.5, 0.25)Scales the radius per red, green and blue channel. The default lets red travel furthest, which gives the warm glow of skin and wax.

Transmission​

Light that passes through the layer: ice, glass.

PropertyDefaultDescription
Transmission Weight1How much light passes through, 0 to 1.
Transmission ColorWhiteTint of the transmitted light.
Transmission Depth0Distance over which the tint builds up inside the medium. 0 tints at the surface.
Transmission Thickness1Thickness of the object, 0 to 10.

A material with transmission draws with the transparent objects. The Layers panel warns "The material draws with the transparent objects." under the cost line.

The puddles layer with Transmission: the cost area lists Coat and Transmission and shows the transparency warning

Thin Film​

An iridescent film on the layer: oil on water, a soap bubble.

PropertyDefaultDescription
Thin Film Weight1How much film there is, 0 to 1.
Thin Film Thickness0.5Thickness of the film in micrometres, 0 to 3. Changes the colours of the iridescence.
Thin Film IOR1.4Index of refraction of the film, 1 to 3.

A material with thin film is shaded in the forward pass. The Layers panel warns "Thin film shades the material in the forward pass." under the cost line.

Worked Example: Snowy Ground​

This example builds muddy ground with snow on top and puddles in the low parts, then reuses the snow on a second material.

1. Add a layer stack​

Create a material, open it and set Shader Mode to Layered in the properties. The Layers tab comes to the front and offers Add Layer Stack; click it. The stack starts with a single base layer.

A material in Layered mode before its layer stack is added

2. Set up the base layer​

Select the Base layer. Name it Mud, leave Source on Textures, and drop the mud's base colour, normal and ORM textures into the slots. The cost line now reads 1/1 layers 4 textures 4 samples per pixel.

The base layer with mud textures

If the ORM texture stores cavity or gloss instead of occlusion or roughness, turn on Invert Occlusion or Invert Roughness.

3. Add a snow layer​

Click + Layer and pick Textures layer. The new layer goes above the base layer with a Slope mask and Height blend. Name it Snow and set its textures. The snow covers the surfaces that face up and settles into the mud by height.

A snow layer with a Slope mask over the mud

Shape the edge in the Mask section: raise Contrast for a sharper line, move Bias to cover more or less. Add a Noise term to break up the line.

4. Check the mask​

Click the snow row's mask thumbnail. The preview now shows the mask, white where the snow shows, and the panel says "The preview shows the mask of Snow. Click its thumbnail again to stop." Click the thumbnail again to see the material.

The preview showing the snow layer's mask

5. Add puddles and move them down​

Add another Textures layer, name it Puddles, and leave its textures empty. Give it a near-black Tint, Metalness 0 and a very low Roughness (about 0.04), and remove its mask terms so it reads everywhere. With Height blend, a negative Height Offset and an Opacity of about 50%, the water only fills the low parts of the mud.

New layers go above the selected one, so the puddles may end up on top of the snow. Select them and click Move Down until they sit between Snow and Mud.

The puddles layer moved below the snow

To make the water look wet, select Puddles, click Add Lobe and pick Coat. The coat fades in with the puddles' mask.

6. Add a graph layer​

For something the panel cannot do, click + Layer and pick From the graph (Make Layer). The stack adds a layer whose Source is Graph and a Make Layer node in the visual shader graph. Wire your own nodes into its inputs; here a colour constant drives the painted lines. Set the layer's Blend, Opacity and mask in the panel as usual. In the screenshot the opacity is still at 0, so the layer does not show yet.

A graph layer named Painted Lines and its Make Layer node

7. Reuse a layer in another material​

Select the Snow layer and choose More > Copy layer. Open another material and choose More > Paste layer above. If that material has no layer stack yet, pasting creates one: the snow goes above a new base layer, with its textures, mask and lobes. Here the new base layer was then given the mud textures so the snow has something to settle on.

The snow layer pasted into a second material

8. Detach the stack to a graph​

When a material needs more than the panel offers, choose More > Detach stack to graph. The stack is removed and its nodes stay in the visual shader graph as ordinary nodes that you can edit freely. The material looks the same; the Layers panel goes back to No layer stack.

The material after detaching its stack: the preview is unchanged and the Layers panel is empty

The visual shader graph keeps everything the stack built: Texture Layer nodes, lobe nodes, mask terms and Blend nodes on the left, and a Split Layer node wired into the OpenPBR output on the right, with the Layers.* portals below it.

The detached graph: Texture Layer, LayerCoat, Mask: Slope, Mask: Noise and Blend: Height nodes

The detached graph: Split Layer wired into the OpenPBR output

Detaching is a single undo step. Once the material is saved and closed, the stack cannot be brought back, so keep a copy of the material if you might want it again.

Showcase Materials​

Three layered materials ship with the engine's sample content, under Materials/Layered. Open them to see the settings in context.

Mud, Puddles and Snow​

Layered_MudPuddlesSnow has a textured mud base, a Puddles layer without textures that height-blends into the mud's low parts with a negative Height Offset and a Coat, and a Snow layer on top with a Slope x Noise mask and Subsurface. It uses 8 samples per pixel.

Mud, puddles and snow

Tiles, Rust and Dust​

Layered_TilesRustDust has a tile base, a Rust layer with a Noise x Noise mask, and a Dust layer with a Slope x Noise mask at 70% opacity. Both upper layers use Mask blend and have no textures, only a tint, so the whole material costs 3 samples per pixel.

Tiles with rust and dust

Triplanar Snow and Mud​

Layered_TriplanarSnowMud turns the idea around: snow is the base and mud breaks through it, with a Noise x Height Below mask. Both layers use Triplanar (World) projection, so they need no UVs, at the price of 24 samples per pixel. The meter is amber.

Triplanar snow and mud with the cost meter over budget

Previewing and Recompiling​

Sliders, colours and other values change the preview without recompiling the shader. Adding, removing, hiding or reordering layers, adding a lobe, and changing a mask term's source recompile it; the preview keeps the last shader until the new one is ready.

As with every material, transform the asset (Ctrl+E) to write the shader that the game uses.

Troubleshooting​

ProblemCause and fix
"A layer stack needs the OpenPBR output"The graph has another output node. Replace it with an OpenPBR Output.
"This node belongs to the layer stack"The stack's nodes are locked. Change the layer in the Layers panel, or detach the stack.
An OpenPBR input ignores the stackThe input is wired to nodes of your own. The panel names it under "Wired to your own nodes, so the stack leaves them alone". Remove your wire to give the input back to the stack.
A Material layer shows greyThe linked material is not an OpenPBR Surface material, or it has no textures switched on.
Occlusion looks invertedThe ORM texture stores cavity. Turn on Invert Occlusion.
Rough and smooth parts are swappedThe ORM texture stores gloss. Turn on Invert Roughness.
The material went transparentA layer has Transmission. The panel says so under the cost line.
The material is expensiveThe meter is amber. Hide layers you do not need, use Mesh UV instead of Triplanar, or drop unused texture slots.

See Also​