Creating and Using Material Functions

A guide to the process of creating and using Material Functions.

Prerequisite Topics

In order to understand and use the content on this page, make sure you are familiar with the following topics:

Creating Material Functions

Use the following steps to create a new Material Function:

  1. Right-click in the Content Browser. In the context menu under the Create Advanced Asset section, open the Materials sub-menu and select Material Function from the list.

    create-material-function.png

  2. Rename the Material Function after it appears in the Content Browser. Your name should be as descriptive as possible so that when someone looks at it they can easily understand what it does. This example ses the name Custom_Fresnel. You can re-name your Material Function by selecting it in the Content Browser, pressing F2 on the keyboard, and typing a new name.

    custom-fresnel.png

Editing Material Functions

After you create a new Material Function, you need to open it in the Material Editor to begin constructing the Material Expression network. You can also open existing Material Functions if you would like to change their behavior. There are two ways to open a Material Function for editing:

  1. Double-click a Material Function asset in the Content Browser to open it in a separate Material Editor tab. You can then edit the Material Expression network within the Material Function to modify its behavior

    Cheap Contrast Material Function asset

  2. Double-click a Material Function node within an existing Material, and the Material Function will open in a new Material Editor Tab.

    Cheap contrast Material Function Call node

When double-clicked, the Material Function opens in a new tab of the Material Editor, showing the Material Expression network contained within the function. You can then edit the graph to your liking.

Cheap contrast material graph

It is important to note that any changes made and saved to a Material Function will propagate to all instances of that Material Function moving forward. For example, if you made a change to the internal network of a Radial Gradient Material Function, all existing instances of that function would receive the update, as well as all new instances moving forward.

For this reason, unless you are certain that your change needs to propagate throughout all other instances of the function, it may be wise to make a copy of an existing function in the Content Browser (right-click and choose Duplicate from the context menu) rather than editing the original material function.

Once you make changes to a function you must click the Apply button to propagate the changes to the function asset and any Materials using the function. Once done, be sure to save your asset in the Content Browser.

Apply changes

Publishing Your New Function

In order to use your Material Function , you need to make sure that it shows up within the Material Function Library in the Material Editor Palette. In order to do this, you must set the Expose to Library property to true.

  1. Deselect all nodes within your function by clicking in the background of the Material Graph. This will display the function's base properties in the Details panel.

    Expose to library

  2. Add a description. This is critical, as putting a description here will cause that description to appear as a tooltip when users mouse over the function in the Material Function Library as well as in Material Editor. Adding descriptions to your Input and Output nodes is certainly good practice, but if you had to choose only one place to comment in your expression, this is by far the most important one.

    Function description

  3. Library Categories Text lets you choose which category your Material Function will appear in. You can add additional categories by clicking Insert, and typing a new category name. However, it is wise to be as concise as possible and not add any more categories than are absolutely needed.

    Function categories

Using Material Functions

From Material Palette

Once you have created your Material Function and published it to the library, you can use it in an existing Material by dragging it directly from the Material Editor Palette. In addition to user-created Material Functions, the Palette contains all the default Material Functions included with the engine.

Material Function library

Default Material Functions are sorted into a wide range of categories. User-created Material Functions are placed in the Misc category by default, but you can change their categorization in the Details panel properties for the function. Drag a Material Function into your Material Graph, and a Material Function Call node is created, containing the various inputs and outputs defined by the input and output nodes within the function.

Drag Material Function from Palette

You can also add Material Functions to your Material by right-clicking in the Material Editor and searching for them in the context menu.

Unspecified Function Node

A third way to use Material Functions is by placing an Unspecified Function node in your Material Graph, and then assigning a Material Function to it in the Details panel.

  1. Hold the F key and left-click in the Material Graph to place an Unspecified Function node.

    Unspecified Function node

  2. Assign a Material Function to the Unspecified Function node in the Details panel. You can search for a Material Function in the dropdown menu in the Details Panel, or you can select a Material Function asset in the Content Browser and click the Use Selected Asset from Content Browser button.

    Use selected asset from Content Browser

  3. The Unspecified Function node is replaced by the selected Material Function – Blend Angle Corrected Normals in this example.

    Blend angle corrected normals node

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