Unreal Engine 4 Graphics: Material Instances

Unreal Engine 4 Graphics: Material Instances

Material instances are fairly simple, but they are really useful. If you use material instances, you won’t have to make ten whole materials just to have a variety of colors to choose from. They use a base material that limits how many nodes, values etc. you have by assigning parameters to the ones that are used, and keeping the other nodes and values constant in the base material, and when an instance is created only the nodes with parameters can be used.

For this example, suppose I want to make a rainbow wall made out of 25 different colored tiles. 5 different colors and 5 different roughness, and one instance per combination. That makes 25 instances.

Creating a base material

Creating one of these is really easy too. To create a material instance you need a base material with parameters. Lets make a base material, and call it “BaseMaterial1”. Now, lets add a parameter to the color node. For colors, you use a parameter called “VectorParameter”. Now this technically isn’t a vector, but it has 3 values; R, G, and B. Since this is a material, the vector represents a color. I want to make the default value, violet. You set a default by clicking on the colored box in the left of the function rectangle. Let’s also give our parameter a name, “Color”.


Now, we need a roughness parameter. We do this the same way but the name of the parameter is “ScalarParameter” becuase this is a single float value. Now, I want to do something different. If you know a bit about materials in UE4, you know that if the roughness value increases, it gets more matte, and as it decreases, it gets shinier. Now, I want to make this the inverse, so that when the value increases, the material becomes more shiny. To do this, I am going to utilize a function called “OneMinus”. The name explains the function: it subtracts the input from one. This is perfect, because roughness, metallic, etc. values are between 0 and 1. So, we can use this to reverse the parameter, to get from shinyness to roughness. Also, lets name this parameter “Shinyness” [shinyness might not be a word though].


But what if someone aminmaxshine.PNGccidentally enters something not between 0 and 1? Then we set a minimum and vmaximum value, 0 and 1 respectively. While we are at it, let’s add a default value too. This is especially useful if you work as a team, should the people who use your base material to make instances accidentally put an invalid value for the parameter.


 Creating a material instance

To create an instance, simply right-click on the material in the content browser, and click on Create Material Instance. An instance should be create, to edit the parameters just do it like a normal material, but instead of the normal material editing window, a window with parameters and a prewiev of the material will be opened. Now, I create those 25 instances, and modify them, then I will put them on the cubes in the wall. [Note: To make 25 instances fast, create 5 with the colors, then duplicate them (CTRL-W) five times, and give the other four sets different values. This is the way I used.]

The result is this:


If you think you got it, try to make a really simple level, using 2-4 base materials, and using instances.If you want, you can add functionality.

If you want to expand on my UE4 work so far, here is the project containing everything I have covered on the topic of UE4.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s