The 3D Handbook
Topic

Master materials and instances

Building a few parent materials with parameters and switches, and making every surface in a project an instance of them; how instances, static switches and material functions work in Unreal, the equivalents in Unity and Godot, how to organise a project, and the debate between one uber-material and several focused masters.

shadersmaterialsengineproductionoptimisation

A master material is a parent material built with parameters and switches, so that many surfaces can share it. Each surface then gets a lightweight material instance that only changes values: textures, colours, tiling, feature toggles. Epic's documentation says an instance "inherits all of its attributes from the parent (or master) Material", and lets you change its look "without incurring an expensive recompilation" (Unreal Engine documentation: Instanced Materials in Unreal Engine).

Most professional environment projects work this way. Artists spend their days in instances; the master materials are built once, carefully, and changed rarely.

#Why work with masters and instances

A tree diagram. At the top, M_Environment_Master. Below it, three instances: MI_Brick_Red, MI_Concrete_Clean and MI_Metal_Painted, each listing a few parameter values. A side panel shows two static switches, Use Detail Normal and Use Vertex Blend, and the four compiled shader permutations they create: off/off, on/off, off/on and on/on, with the ones actually used by instances highlighted in orange.
Instances change parameters without recompiling. Static switches are different: each combination actually used by an instance becomes its own compiled shader.Diagram by the handbook author

#Parameters, static switches and instances in Unreal

#Parameters

A parameter is a node with a name that instances can override: scalar (one number), vector (a colour or four numbers), and texture parameters. Changing them in an instance does not recompile the shader (Unreal Engine documentation: Instanced Materials in Unreal Engine).

#Static switches

A static switch parameter turns a whole branch of the graph on or off. It is "applied at compile-time" (Unreal Engine documentation: Instanced Materials in Unreal Engine), so a disabled branch costs nothing at runtime. Static switches can "remove an entire branch of a material with no runtime cost" (Epic Developer Community Forums: Knowledge Base: Understanding Shader…).

Static switches have a cost: "A new Material is compiled for every combination of static parameters" used by instances (Unreal Engine documentation: Instanced Materials in Unreal Engine). Two switches give up to four shaders, ten switches up to 1,024, and that is before the engine multiplies them again for different mesh and lighting types. Epic advises you to minimise static parameters and the combinations actually used (Unreal Engine documentation: Instanced Materials in Unreal Engine). On AnswerHub, an answer about one huge FX material summarised the problem as "Exponential growth" (Unreal Engine AnswerHub: Some artists have built massively deep…).

Static switches cannot be changed from scripts at runtime (Unreal Engine documentation: Instanced Materials in Unreal Engine). For that, use dynamic parameters.

#Constant and dynamic instances

#Material functions

Material Functions are "snippets of Material that you can save in packages and reuse across multiple Materials" (Unreal Engine documentation: Material Functions in Unreal Engine). Edits to a function "propagate throughout all Material networks which use it" (Unreal Engine documentation: Material Functions in Unreal Engine). Build your height blend, detail normal or wetness logic once as a function and use it in several masters.

The same propagation that makes functions useful also makes them expensive to change. The AnswerHub answer notes that editing a shared function forces every material using it to recompile (Unreal Engine AnswerHub: Some artists have built massively deep…).

#Naming

Epic recommends prefixing parent materials with M_ and instances with MI_ (Unreal Engine documentation: Instanced Materials in Unreal Engine). Add MF_ for material functions and be consistent; see naming conventions.

#Unity: shaders, materials and material variants

In Unity a shader (from Shader Graph or code) plays the role of the master logic, and materials are like instances: they set the shader's properties.

Material Variants add a hierarchy on top. A variant is a material "that inherits the properties of a parent material" (Unity Manual: Material Variants). You can "change a parent material and automatically propagate those changes down to all the child materials", override values in children, and "lock properties so child materials can't override them" (Unity Manual: Material Variants). That gives you something close to Unreal's master → instance → child instance chains.

Unity's equivalent of static switches are shader keywords, which create shader variants. Unity warns about "combinatorial explosion": ten on/off keywords produce 1,024 variants, which increases build time, file size, memory and loading time (Unity Manual: Shader variants). Its advice is to strip variants you do not need and use variants only for branches that would be costly at runtime (Unity Manual: Shader variants).

#Godot: shaders, ShaderMaterial and uniforms

In Godot, a Shader resource holds the logic, written in Godot's shading language or built as a visual shader, and a ShaderMaterial uses it (Godot Engine documentation: Using VisualShaders). Uniforms in the shader become the parameters: they "will appear as editable parameters in the material's inspector" (Godot Engine documentation: Shading language). Many ShaderMaterials can share one Shader, each with its own uniform values, which is the same pattern as master and instances.

Godot has two extra levels:

  • Per-instance uniforms "are set on each GeometryInstance3D, rather than on each Material instance", so one material can vary per object. They do not support textures or arrays, with a practical maximum of 16 per shader (Godot Engine documentation: Shading language).
  • Global uniforms are "global to all shaders in the entire project", useful for things like a world-wide wetness or snow value (Godot Engine documentation: Shading language).

#Organising a project's materials

A practical structure for an environment project:

  1. A small set of masters, each with a clear job. For example: opaque environment surfaces, foliage, glass, decals, water, terrain.
  2. Shared material functions for logic used in several masters: height blending, detail normals, wetness, macro variation.
  3. A library of base instances for each surface type (red brick, clean concrete, painted steel), tuned once and reused.
  4. Child instances for local variations (dirtier brick for one area), so the base library stays clean.
  5. Folders and names that make sense to the whole team, for example Materials/Masters, Materials/Functions, Materials/Instances/Brick.

Write down what each master supports, and which switches are expected to be on, in the art bibles and style guides or a team wiki page.

#Keeping shader counts under control

  • Only add a switch when the feature is expensive and many instances will not use it (detail normals, parallax, emissive). Cheap features can stay as parameters set to zero.
  • Avoid switches nobody uses. Every combination used by at least one instance gets compiled (Unreal Engine documentation: Instanced Materials in Unreal Engine).
  • Prefer a few combinations. Ten instances with the same switch settings share one permutation; ten with different settings make ten.
  • Consider project-wide reductions. In Unreal, settings under Engine > Rendering > Shader Permutation Reduction can reduce shader permutations by "up to 50%", according to Tom Looman, depending on which lighting features a project uses (tomlooman.com: Optimizing Shader Compilation Settings &…).

#In different tools

Master logic Per-surface settings Feature toggles Reusable logic
Unreal Material Material Instance (constant or dynamic) (Unreal Engine documentation) Static switch parameters Material Functions (Unreal Engine documentation)
Unity Shader / Shader Graph Material, Material Variant (Unity Manual) Shader keywords, which create variants (Unity Manual) Shared Shader Graph assets
Godot Shader (text or visual) (Godot Engine documentation) ShaderMaterial uniforms; per-instance uniforms (Godot Engine documentation) Uniforms (dynamic) Shader code shared between materials

#Further reading and watching

Epic's own introduction to parameters and material instances; a good first step before building your own master. Watch on YouTube

References

  1. Epic Games · Instanced Materials in Unreal Engine · Unreal Engine documentation · docs · accessed 2026-10-21
  2. Harry Gray · Technical Tips for Environment Artists: Part 2 · 80 Level, 2019 · article · accessed 2026-10-21
  3. Matt O. (Epic Games), with community replies · Knowledge Base: Understanding Shader Permutations · Epic Developer Community Forums, 2021 · forum · accessed 2026-10-21
  4. Unreal Engine AnswerHub (question and answer) · Some artists have built massively deep material hierarchies - One material pretty much to do all FX · Unreal Engine AnswerHub · forum · accessed 2026-10-21
  5. Epic Games · Material Functions in Unreal Engine · Unreal Engine documentation · docs · accessed 2026-10-21
  6. Liam Tart (PogoP), community tutorial · SciFi Bunk: Material Instancing · Unreal Engine 4.27 documentation · docs · accessed 2026-10-21
  7. Unity Technologies · Material Variants · Unity Manual (Unity 6) · docs · accessed 2026-10-21
  8. Unity Technologies · Shader variants · Unity Manual (Unity 6) · docs · accessed 2026-10-21
  9. Godot Engine contributors · Using VisualShaders · Godot Engine documentation (source on GitHub) · docs · accessed 2026-10-21
  10. Godot Engine contributors · Shading language · Godot Engine documentation (source on GitHub) · docs · accessed 2026-10-21
  11. Arti Sergeev · UE4 Master Materials by Wiktor Öhman · 80 Level, 2017 · article · accessed 2026-10-21
  12. Tom Looman · Optimizing Shader Compilation Settings & Reducing Package Sizes · tomlooman.com, 2020 · article · accessed 2026-10-21
  13. Polycount forum (aaronkaminer, gsokol, Snefer, spahr, WarrenM and others) · (UE4) Ultimate Custom Master Material!! · Polycount, 2014 · forum · accessed 2026-10-21
  14. Polycount forum (AndrewAlexArt, Ged, convolution223) · [WIP][UE4] Emily's house · Polycount, 2016 · forum · accessed 2026-10-21

Also consulted

Last updated 2026-10-22