Creating and Using Material Instances

Guide for setting up and using Material Instances

Windows
MacOS
Linux

Creating and editing standard Materials in UE4 can be a time consuming process. To help speed up and streamline the Material creation workflow, UE4 offers a special type of Material called a Material instance. In this tutorial you will learn how to set up and use Material instances in your projects.

Material Instancing

Material instancing is a way to create a parent Material that you can use as a base to make a wide variety of different looking children (Material instances).

To achieve this flexibility, Material instancing uses a concept called inheritance: the properties of the parent Material are passed to its children. Properties that are designated as parameters in the parent Material are exposed to artists in the Material Instance Editor.

Material Instance Editor

Using Material instances, you can create numerous variations from a single base Material:

Three Material instances

Creating Material Instances is a Two Step Process

  1. First create a parameterized Material that you will use as the parent Material for your instances.

  2. Create a Material Instance Constant in the Content Browser. You can then customize the Material in the Material Instance Editor.

For additional background information about Material instancing, read the overview here.

Creating a Parameterized Material

A Material instance inherits all the attributes of its parent Material, but not all of these attributes can be customized in the Material Instance Editor by default.

To make Material attributes editable in a Material instance, you must designate certain attributes as parameters by using parameter nodes instead of regular Material Expressions.

There are two ways to add parameter nodes to your Material graph.

Adding Parameter Nodes from the Material Palette

If you search for the word "parameter" in the Material Palette, or from the right-click menu in the Material Editor, you can find all of the parameter nodes that are available.

You can drag and drop these parameter nodes from the Palette or select them in the right-click menu to add them to your Material graph.

Add parameter nodes from palette

Parameters in the right-click menu (left) and the Materials Palette (right).

Parameter Shortcuts

Two of the most commonly used Material parameters have keyboard shortcuts in the Material Editor:

  1. Scalar Parameter - Hold the s key and left-click in the Material graph to place a Scalar Parameter. A Scalar Parameter is the parameterized version of a Constant, and contains a single numeric value.

  2. Vector Parameter - Hold the v key and left-click in the Material graph to place a Vector Parameter. A Vector Parameter is the parameterized version of a Constant 4 Vector and contains four floating-point values.

Use the shortcut or palette to place a Scalar parameter in your Material graph:

Scalar parameter roughness

Name the parameter Roughness and connect it to the corresponding Material input.

Default Value and Value Range

If you want to set a default value for the parameter or limit the value range, you can do so in the Details panel.

Material parameter default value

For example, the Roughness input accepts a value from 0 to 1. To make sure the Roughness parameter always stays within this expected range, set the Slider Min and Slider Max values to 0 and 1.

If you want a default Roughness value other than 0, enter it in the Default Value field.

Select the Roughness parameter and press Ctrl+W to duplicate the node. Rename the second scalar parameter Metallic and connect it to the appropriate input. Your graph should now look like this:

Metallic and roughness parameters

Converting a Node into a Parameter

You can also convert standard Material Expressions into parameters within an existing Material graph.

For the sake of demonstration, place a Constant3Vector node in your Material graph. This is a standard (non-parameterized) Material expression, which can be used to set the Base Color of a Material.

Constant 3 Vector

To convert this node into a parameter, right-click the node and choose Convert to Parameter from the contextual menu.

Convert to parameter

Remember to give the parameter a unique, descriptive name like BaseColor. The naming field is selected automatically when you convert a node.

Rename parameter

You can change the color in the Default Value field shown above, or you can double click the BaseColor node to open the color picker.

Change default color

You cannot parameterize every Material node in UE4, but the Convert To Parameter option is available from the right-click menu for any Material expression that can be parameterized.

Parameterized Material Example

Your Material graph should now contain a Vector parameter plugged into BaseColor and two Scalar parameters, plugged into the Metallic and Roughness inputs:

Simple parameterized Material

These three parameters will allow you to change the color, roughness, and metallic properties of the Material once you create a Material instance.

Click Apply in the upper left corner of the Material Editor to compile the Material, and then click Save.

Compile Material

Creating a Material Instance

Now that you have a simple parameterized Material, you can create Material instances and customize them in the Material Instance Editor.

To create a Material instance, right-right click your Material in the Content Browser and choose Create Material Instance from the menu.

Create Material Instance

Your Material instance will derive its name from the Material that you are using to create it. You can rename the Material instance by selecting it and pressing F2 or by single-clicking the name field.

Rename Instance

Editing a Material Instance

Double-click the Material instance in the Content Browser to open the Material Instance Editor.

Open Instance Editor

The Material Instance Editor is the interface where you can customize Material parameters to produce different looking variations of your parent Material.

Material Instance Editor

A Material instance in the Material Instance Editor.

Adjusting Material Parameters

Material Parameters are found in the Details panel on the right side of the Material Instance Editor. Note that these parameters take their names from the parameter nodes in your original Material graph.

Use the following steps to edit a parameter:

Override Material Parameters

  1. Place a check in the box next to the parameter to enable it for editing.

  2. Type a new value in the field or left-click and drag to slide the value up and down. For Vector parameters, left-click the color swatch to activate the color picker.

  3. To reset a parameter to its default value, click the arrow icon pictured here.

As you adjust parameters, the Material preview will update in real-time in the Material Instance Editor, and in the Level if the Material is currently applied to any Actors.

Using Parameter Groups

You can sort your parameters into Parameter Groups to improve the organization and readability of your Material instances.

While the above example with only three parameters is easy to read, heavily parameterized master Materials can be inefficient to interact with if you do not use parameter groups.

The slider below shows instances with and without groups. In the example without parameter groups, scalar parameters appear in a single unorganized list. The instance with parameter groups is neatly organized by Material attribute.

Material Instance without Parameter Groups

Material Instance with Parameter Groups

How to Use Parameter Groups

Parameter groups are configured within the parent Material, not within the Material instance. This is done in the details panel of the Material Editor.

Select a Material parameter node in your Material graph.

Base Color

In the Details panel, type a name into the Group field. You can name your groups however you wish, but one suggestion is to group parameters by the Material attribute they control.

Parameter Group

After you create a parameter group it will appear in the drop-down menu next to the Group field.

For the rest of your parameters, you can either type in additional group names or select an existing parameter group from the drop-down menu.

Select parameter group

Ordering Parameter Groups

By default, UE4 will order your parameter groups alphabetically in the Material Instance Editor.

If you want to change the order in which parameter groups are displayed, the best solution is to use numbered group names.

For example, in the Megascans master Material, the parameter groups are numbered 00 – 07.

Megascans parameter groups

This allows the parameter groups to display in the same order they appear in the Main Material Node.

Changing the Parent Material of a Material Instance

You can easily change the parent Material used by a Material instance, in the Material Instance Editor.

To change the parent Material, open a Material instance in the Material Instance Editor. Under the General section in the Details panel, find the Parent property.

Parent material field

Use the drop-down menu to search for and select a different parent Material. You can also select a Material in the Content Browser and click the Use Selected Asset in Content Browser button (left-facing arrow).

Note that if you change the parent Material it can completely change the appearance and properties of the Material instance. The parameters you were using before may no longer be available in the new parent.

Change parent Material

For example, if you select the M_Metal_Gold Material from the drop-down list, the three parameters that were present in the M_Parameterized example (roughness, metallic, base color) are no longer available in the gold instance.

Gold Material

Conclusion

Material Instancing is a powerful tool that can be used across all aspects of your project. From helping to add some variation to weapons and props, to helping artists make better use of available Materials, Material Instances can help to streamline and unify how Materials are created and used in your project.

Tags
Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss