Environment artist Clinton Crumpler gave a detailed explanation of Material Functions in Unreal Engine 4.
CG Master Academy instructor and environment artist Clinton Crumpler talked about the subject of Material Functions in Unreal Engine 4.
Hello! My name is Clinton Crumpler and I am an Senior Environment Artist at The Coalition as well as an instructor at CG Master Academy. I currently teach one of many courses offered, entitled UE4 Modular Environments. This course encompasses multiple aspects and avenues of production of environments for games, with a focus on modularity. The key to modularity is understanding and building assets with smart reuse and implementation during the production pipeline. This will allow you to maximize your time and efficiency to become a masterful environment artist.
Here are some examples of past student work in the UE4 Modular Environments course:
CGMA Student: Raphael Tavares
CGMA Student: Richard Rude
CGMA Student: Jake Higgs
CGMA Student: Tom Meltser
When creating any scene you will need to create materials for all of your assets. Each material dictates how the surface of the mesh will be displayed to the viewer. Most artists who use Unreal have a decent understanding of how to create a simple material to utilize the textures they have created in an external program such as Photoshop, Substance, or Quixel. As you delve further into the Unreal material system, you quickly become aware of what a powerful tool it is for creating a material and tailoring the look of it–by stringing together multiple nodes to create specific material effects.
When considering ways to maximize your efficiency when using the Unreal Engine material system, the use of Material Functions plays an important role. In the next few sections, I’ll go over why Material Functions are powerful tools for creating materials in Unreal and discuss how to make your own Material Function.
What are Material Functions?
A Material Function is essentially a small grouping, or a pre-packaged group, of nodes to complete a given function or computation within the material. This Material Function can be used and added to multiple materials and similar material masters and material instances; you can then edit the Material Function and those changes will be propagated out to each material using the function. Some of the nodes you are already using may be Material Functions and you might not even know it! If you have ever used any of the Blend nodes, a Height Lerp, or a Gradient node you have already been using Material Functions.
For instance, while creating a material in Unreal you may multiply a Texture Coordinate node with a number to increase the amount of scaling of a texture. Every time you want to multiply a Texture Coordinate node with a number to change the scale, you have to place those nodes into the material setup. This can become needlessly tedious. By creating a simple Material Function to house that computation of information, you can simply drag in a single node to perform that function. Let’s start by making our own.
How to create a Material Function
1. In your Content Browser, right-click in any blank space in the Asset Management Area and navigate to Material Function. Clicking this will create a new Material Function.
2. Feel free to rename it whatever best suits the function that it will be performing. For this example we’ll be naming it MF_texturetiling (“MF” standing for Material Function). Starting out, we can see our function is pretty empty besides a single node. This node is called the “output node” and outputs all of the information from our Material Function to be used in the material that the function is nested in. We can create multiple outputs, but let’s just use this one for now. The rest of this area functions exactly how a standard Unreal material works with the use of all of the nodes in the righthand menu.
3. Let’s start by creating the basic setup that we might usually make to control the tiling of a material. First we will right-click in the node space and type the word “multiply” to bring in a Multiply node. With the right side output of the multiply, let’s route this into the left side input of the Output Result node by left-clicking and dragging from one pin to the other.
4. Now let’s right-click again in the node space and create a Texture Coordinate node and plug it into the first input slot of the Multiply. The Texture Coordinate node controls the UVs of a texture used in a material.
5. Next let’s right click and create a simple constant. This constant is a number used to represent how many times the texture connected to this Material Function is tiled. By default the value of the constant is set to 0. Let’s change it to 1 by clicking on the node and in the details setting the value to 1. Now let’s connect the output to the second input of the Multiply node.
6. Now we need to change the Constant 1 we created to be used as a “parameter,” or editable value. This can be done by right-clicking on the node and selecting “Convert to Parameter.” You can now rename this parameter in the details of the node for easy recognition while editing your final material later.
Your setup should end up looking something like this:
7. Now your first Material Function is complete! Let’s try using it in a simple material setup. Here is a basic tileable material setup:
I now want to use my new Material Function to control the tiling of the textures in the material. Simply left-click and drag the Material Function into the node editor of the basic material, then connect the output of the Material Function into the UVs input of each of the textures used in the material.
8. Now you can create a material instance by right-clicking the Basic_Material material and selecting “Create Material Instance.”
9. Now by applying this Material_Basic_Inst to any asset you are able to control the tiling of the texture. Open the controls to this by double-clicking the Material_Basic_Inst in the content browser; under the Parameter Groups you will see the parameter we created called “Tiling Amount.” Clicking the tick mark next to the option will enable you to change the tiling amount of the texture. Our Material Function is now tested and working! Now you can reuse this Material Function in other materials for easy setup of texture tiling.
While this is a very simple procedure, the more you work with Material Functions the more complex and useful setups you can create to integrate into your own production pipeline. Using these functions will help you optimize the work you do in the material editor and make you a more efficient artist.
To learn more about the class check out the details here.
For more of my work, check out my portfolio.