Material Layers

Build complex layered and blended materials that take advantage of material instancing.

Windows
MacOS
Linux

The Material System in Unreal Engine is powerful and affords you many options when choosing how to develop and build materials for your projects. One powerful part of that system is being able to layer and blend different textures together to create a unique material for the objects you place in your levels. Similar to the workflow of Layered Materials with Material Functions , Material Layers enables you to use it's own asset types in your material graph to combine and blend your textures. This alternative workflow simplifies the process of layered and blended materials by taking advantage of Material Instancing .

Key Benefits

One of the benefits to using Material Layers is that you can use it to create what would otherwise be a very complicated material, while keeping it much more manageable from a future editibility standpoint. While it's possible to create the same type of material using Layered Materials workflow or in a conventional Material (without layers and Material Functions), the Material Layers workflow provides better control, flexibility, and reduced complexity in your material creation when using this method.

For instance, let's take a high-level look at a Layered Material using the Layered Material graph (below left) compared to using a Material Layers (below right). You can quickly recognize that the workflow reduces the amount of work required in base Material, leaving the work and functionality to be done in the Assets themselves.

MaterialFunctionsWorkflow.png

MaterialLayersWorkflow.png

Base Material using Material Function workflow

Base Material using Material Layers workflow

The limitations of how Material Functions work with instantiation means that any parameters created in a Material Function cannot be referenced in a Material Instance without first being duplicated in the base Material. In contrast, any parameters set up in the Material Layer Asset are able to be instanced themselves, and only the base Material Layer needs to be referenced in the base Material for the input that it will affect.

When opening a Material Layer or Material Layer Blend Asset, the node graph is similar to those of the other Material Editors. This is where you'll set up all the node logic and parameterization you'll use for the Material. Setting up your logic primarily in the Material Layer Asset means that it's less complicated to manage when making big or small changes in your Materials. It also means that you can use similar Material Layers across multiple materials without duplicating your work, similar to how Material Functions work but with much more flexibility in application and usage.

Click image for full size.

All of the parameters set up here are referenced in the Layers added to the stack in a Material Instance of the Material that is using Material Layers. This means there is no need to duplicate any of these parameters in your base Material when creating its Material Instance. When opening the Material Instance, the Layer Parameters tab holds all the Material Layers that have been added to this instance.

Click image for full size.

The Material Layer Blend Asset is used to control masking for the Layers referenced in this Material Instance. Each Layer can have its own Material Layer Blend and is not limited to a single blend asset for all layers in the stack. Without a blend asset assigned to a layer, the top most layer without a blend asset will always override any layers below it. Like the Material Layer Asset, Material Layer Blends have their own node graph where you can set up your own blending and masking logic for defaults and parameterization, which can also be instanced and reused across multiple materials.

Click image for full size.

This workflow lets you to contain the complexity of a portion of your material logic to a single asset while affording you the flexibility to reuse this for any other Materials you may create.

Enabling Material Layers

Open the Project Settings window and, navigate to the Rendering > Materials category, and enable Support Material Layers.

EnableMaterialLayers.png

You will need to restart the editor for this feature to take effect.

Usage

The following steps are the high-level approach to creating and using Material Layers for your Materials in your projects:

  1. Create your Material Layer Asset(s).

  2. Create your Material Layer Blend Asset(s).

  3. Create a conventional Material Asset.

  4. Add a Material Attribute Layers expression to evaluate the active Material Layer stack and output the merged attributes.

  5. Create a Material Instance of your base Material.

  6. Use the Layer Parameters tab to add, edit, and manage layers for your Material.

Material Layer Asset Types

Material Layers is composed of two asset types:

  • A Material Layer Asset is used to create a layer that can be masked or blended with other layers in the material.

  • A Material Layer Blend Asset is used to create a mask for blending two layers together.

Both of these asset types can be added to your project from the Content Browser by clicking the Add New button, or using the right-click context menu and selecting the assets from the Materials & Textures category.

AddNewMenu.png

Material Layer Asset

The Material Layer Asset, like a Material Function , has its own graph where you can set up your node graph logic and preview it for the Material. For each type of material that you want to create, you can use the Material Attributes expression to handle the logic and output that result. For instance, if you wanted to create a chrome or emissive material, you'd set up your textures and parameters in this graph like you would in any normal base Material graph.

This is an example of a simple material graph showing a chrome-like material set up in a Material Layer graph.

Click image for full size.

Material Layer Blend Asset

The Material Layer Blend Asset, like a Material Function , has its own graph where you can set up your node graph logic and preview it for the Material. For each type of blend or layer that you want to create, the graph has a Input Bottom Layer and Input Top Layer setup with a BlendMaterialAttributes expression. You can apply additional logic for those inputs or simply use the Alpha input to drive your own masks and blends for the layers in the Material Instance layer stack.

This is an example of a simple material graph showing using a mask to drive the alpha for the BlendMaterialAttributes expression in the Material Layer Blend graph.

Click image for full size.

Base Material Graph

In your base (or parent) Material, instead of placing all your node logic in the graph, you'll rely on the Material Layer and Material Layer Blend Assets to handle that. This reduces the amount of management required in your base Materials.

When using Material Layers, you'll want to be sure that you've enabled Use Material Attributes by selecting the main material node and setting it in the Details panel.

UseMaterialAttributes.png

In the simplest form, having a Material Layer Expression that is used to reference the Material Attributes of that Material Layer for your base material's output. For example, this Chrome material is using a Chrome Material Layer and then gets and sets the material attributes referenced in it for output.

BaseMaterial.png

Material Layer Expressions

The Material Attributes Layer expression is used to evaluate the active Material Layer Stack. When you select the Material Attribute Layers expression, you can use the Details panel to set the default layers to be used with any Material Instance that is created, like the Background material layer or any additional layers.

MaterialAttributesLayersDefaults.png

When you create your Material Instance, or apply this material directly to an object in your project, the default Material Layers will be used.

For more complex materials that you set up, the Get Material Attributes and Set Material Attributes expressions are able to add and taken in Material Attributes you want to set up in your base Material rather than setting it up specifically in the Material Layer.

MaterialLayerExpression_AttributesNodes.png

Material, Layer, and Blend Instancing

Just like a Material can be instanced to create a unique material created from specified parameters, a Material Layer and Material Layer Blend can also be instanced. This provides access to any of the nodes in its graph that have been parameterized.

You can create an instance of a Material Layer or Material Layer Blend by selecting it in the Content Browser. From the Context menu, select Create Layer Instance or Create Blend Instance, respectively.

Click image for full size.

When you parameterize nodes in your base material layer graph, those parameters become accessible to any child instance created, like Material Instances you would normally create. For Layers and Blends, you'll find them listed in the Material Instance Layer Parameters tab where any parameters for that given layer have been set up.

MaterialLayerParameters_MI.png

Each layer's parameters are exclusive to that layer. If you have multiple layers in the stack using the same Material Layer, setting an overridden parameter value in one layer in the stack will not override the same layer's parameters in that same layer stack.

Passing Parameters

There are a couple of ways to pass parameters from your Material Layers and Material Layer Blends to your Materials and Material Instances. Most of these suggestions apply to layers and blends.

  1. Create a parameter within a Material Layer behaves similarly to existing Materials and Material Functions.

    Parameters added within a Material Layer and a Material Layer Blend graphs are unique to that layer or blend. For example, the Material Layer below is using a Vector Color, a Texture parameter for a roughness map, and two scalar parameters for metalness and color. These are set up just like they would be in a standard Material or Material Function.

    Param_1.png

    When a standard Material is instantiated that uses Material Layers and this layer has been added to the Layer Parameters tab of that Material Instance, you will find that all the parameters are available for editing.

    Param_1a.png

  1. Use the input pin to the Material Attributes Layers stack expression in your base Material.

    In your standard Material graph, this takes another Material Attribute as input using the Set Material Attributes expression, which will be piped to every layer added to the Material Attribute Layers expression stack.

    In this example, we pass a base normal map texture parameter like this:

    layer_ma_output.png

    Then, within the Material Layer Asset, the input and blend in can be set using the Set Material Attributes expression. Additionally, each layer can use or ignore the base stack material attributes input

    layer_ma_input.png

Layers Stack

Material Layers uses in a Material Instance can toggle their visibility using the Layer Parameters tab, assign new Material Layer Blend Assets, and drag-and-drop layers in the stack for top-down dependency.

MaterialInstanceEd_ML.png

From the Layer Parameters tab, you can override and edit any parameters exposed for that Material Layer or Material Layer Blend. These parameters are exclusive to the layer. So, even if you were to add the same Material Layer to this layer stack multiple times, the parameters would be uniquely set for that layer in the panel.

MaterialInstanceEd_MLParameters.png

Additionally, you can toggle visibility of each layer in the stack without removing or losing any work you've created. Click the Eye icon to toggle visibility of any layer in the stack.

MaterialInstanceEd_ToggleLayerVis.png

Toggling visibility of a layer disables it and displays the next layer in the stack based on layer blend and parameter settings already used in the stack by other layers. The example below disables a Material Layer with its own unique properties and blend mask for the sides of the chest plate. When disabled, the next layer displays the chrome material used by other parts of the chest plate.

Layer Visibility: Enabled

Layer Visibility: Disabled

Lastly, each layer in the stack can be dragged and dropped with the top-most layer taking priority over any below it. Note that the Background layer cannot be moved and set in the base parent Material as the default material when no other Material Layers are present.

Additional Resources

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback