Unreal Engine 4.19: Using Material Layers
Subscribe:  iCal  |  Google Calendar
7, Mar — 12, Jun
San Francisco US   19, May — 24, May
London GB   29, May — 1, Jun
Birmingham GB   1, Jun — 4, Jun
Taipei TW   5, Jun — 10, Jun
Latest comments
by derjyn@gmail.com
4 hours ago

$16 for a *very* non-performant material? If this was intended for use in high-detail scenes, not meant for gameplay, one would generally just use a flipbook animation, or looping HD video texture (both of which are higher quality and available for free all over). I love options, but c'mon, that's pretty steep. $5, maybe. And you can loop in materials, using custom HLSL nodes. Also, there are better ways of doing this, all around. Somewhere on the forums, Ryan Brucks (of Epic fame) himself touched on this. I've personally been working on a cool water material (not "material blueprint", thankyouverymuch) and utility functions, and am close to the quality achieved here, sitting at ~180 instructions with everything "turned on". The kicker? It's pure procedural. No textures are needed. So this is cool, no doubt about that. In my humble opinion though, it's not "good". It doesn't run fast, and it's more complicated than it needs to be.

Lee is right - you can use a gradient effect when you vertex paint in your chosen 3d modelling platform (I've done it in max), meaning the wind effect shifts from nothing to maximum along the length of the leaf/branch/whatever.

by Lee Stojkovic
4 hours ago

I'm fairly certain you can vertex paint the bottoms of the foliage and control the movement using vertex colors along with the wind node. I did this in an earlier project and was able to create a scene with grass that moved less and less as it went down until stationary. I created the grass and painted the vertexes black to red (bottom to top) in Maya.

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 on "Unreal Engine 4.19: Using Material Layers"


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