Unreal Engine 4.19: Using Material Layers
Subscribe:  iCal  |  Google Calendar
Kyiv UA   22, Sep — 23, Sep
Valletta MT   23, Sep — 29, Sep
24, Sep — 27, Sep
Tokyo JP   25, Sep — 27, Sep
San Diego US   27, Sep — 30, Sep
Latest comments

there is no need to create a vdb, but it works yes

by Laurent BIAL
18 hours ago

Super taf! ;)

Ted Bundy's car? :D

Unreal Engine 4.19: Using Material Layers
17 January, 2018

The Epic team has added support for Material Layers in the latest version of Unreal Engine. Basically, Material Layering is a new way of mixing materials in a stack, which allows you to generate the correct material graph with no need to create the node graph by hand. 

Check out some basic documentation from the team below to learn how you can use the new system:

To enable this feature, navigate to the Editor Preferences > General > Experimental > Materials and set Material Layering Enabled true.

Material Layering is a new way to combine materials in a stack, which builds out the correct material graph without needing to build the node graph by hand. There are two new asset types that we use to do this:

  • Material Layer
  • Material Layer Blends

Functionally, these behave similarly to Material Functions. These new asset types also enable you to create child instances, which you could not do with Material Functions.

Material Layer assets have a default input node which pipes base Material Attributes in from the Material. Material Layer Blend assets have two default input nodes which enable you to access the Material Attributes from layers above and below.

Once you have created a Material Layer and Material Layer Blend asset, you can combine them using a Material Attributes Layers node in a Material. With the node selected, you can add layers and set the assets that each layer and blend should from the node Details panel.

When editing a Material Instance with a parent Material that contains a Material Attribute Layers node, the Material Instance Editor also contains a Layer Parameterstab. Here, you can change the assets used for any of the existing Layers or Blends that have been set. Use the Add (+) button to add additional Layers to the stack as needed. You can also see the parameters contained in each of the Material Layer and Material Layer Blends and override their values indivually by entering a new one.

Passing Parameters to Layers

There are three main methods at present to do this, most of which apply to Blends and Layers.

  1. Create a parameter within the layer which behaves similarly to existing Materials and Material Functions.
    Parameters added within the layer graphs will be unique to that layer and editable within the layer’s section. Even if multiple copies of the same layer are added, each will have its own copy of that parameter to control.
  2. Use the Input pin to the Material Attribute Layers stack.
    This takes another Material Attributes as input which will be piped into every layer added. For example, we could pass a base normal map for the mesh as an input, like so:
    Then within our example Material Layer, we get the Input and blend in:
    Each layer can optionally use or ignore the base stack material attributes input. Currently, this method is not accessible within a blend graph.
  3. Using Shared Input Connections (New Feature)
    These function very similarly to Material Parameter Collections though rather than setting the data in a Global Blueprint, they are used for connecting data between Material Graphs. You will create the asset using the same method by making the asset and filling in the list of available parameters, their names, and types:

The parameters listed will be available for use within your Material Graphs. There are two parts to using the system. The first is setting the shared inputs, which should generally be done at the top-level Material Graph. Continuing with the example collection, the inputs are hooked up to parameters in this case but could be any material graph nodes:The parameters listed
As the parameters here are connected from the main Material Graph, they will be listed in the Material’s Global Parameters list when editing a Material Instance. In this respect, the parameters will be shared between any other graphs that read from them.

The next step is to get the shared input parameters, which can be done within a Material Graph, Layer Graph, or others. All instances of a Get Shared Input node will read the same shader input data, in this case, our global parameters. The following reads the shared data within a layer graph on the stack:
This enables a system where parameters and graph inputs can be shared between layers, however, when editing an isolated instance, we don’t have access to the Material where the shared input is set. This behaves similarly to Material Function inputs and a preview value can be provided in the same way:
The preview values will be used based on the parameter type that is set in the collection, so only the relevant data needs to be filled in. The preview value will be used when generating the layer preview, asset thumbnail, and any other case where the layer must be compiled in isolation.

Of note, the Get Shared Input node in the graph above lists as a Texture2D input. This type is set if the parameter is found but will list an unknown type error if the parameter no longer exists. There is no system in place at this time to automatically rename parameters for you. In a future release, this may be implemented or the Name entry box replaced with a drop-down list of available parameters.

Tim Hobson, Epic Games 

The guide was originally published here


Leave a Reply

1 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
1 Comment authors
Ryan Recent comment authors

Correction: To enable this feature, navigate to the Project Settings > Rendering > Experimental and set Support Material Layers true.