If you’re new to Unreal Engine, materials might seem a bit overwhelming. But don’t worry, they can be challenging even for experienced developers. Maybe you haven’t heard about materials at all.
In this lesson on the Unreal Engine Learning Path, I’ll show you the basics of materials and everything you need to start using them.
What is a Material?
Materials are used in 3D modeling and game development to define the visual appearance of a 3D object.
Imagine a 3D chair, for example. It could be made of wood, metal, or plastic and may have any color you can think of.
The material serves as a set of rules for the computer, guiding how the chair should appear, but not determining its shape. It only describes the chair’s colors and textures.
How can I change and apply materials?
If you have a new blank project, I recommend using a template or the Starter Content for this lesson. This way, you’ll have some materials to play and experiment with.
There are four easy ways to change materials, so let’s take a look at them.
1. Drag & Drop the Material
The quickest way to change a material is to select the desired material in the Content Browser and then drag and drop it onto the static mesh you want to apply it to.
In the example below, you can see that when a material is about to be applied to an object, the material is marked in blue in the Details Panel.
2. Change Material in the Details Panel
In the Details panel, search for ‘Material‘ and open the material list to make the change.
3. Change Material inside the Static Mesh
It is also possible to open the static mesh by double-clicking the asset in the Content Browser.
Then go to the Material Slots in the Details tab. There, you can change the default material of the asset.
4. Change Materials using Blueprints
If you’re looking to switch materials in Unreal Engine while your game is running, you can easily achieve this by using the ‘Set Material‘ node in Blueprints.
Just make sure the ‘Element Index‘ matches the ‘Material Slot‘ you want to change, and pick the desired new material from the ‘Material‘ list.
In the example below, pressing ‘F’ on the keyboard triggers a Keyboard Event that changes the material, and pressing ‘G’ puts it back to its original state.
How can I create Materials in Unreal Engine?
Creating a material in Unreal Engine is extremely easy.
Simply right-click in the Content Browser or press the ‘+Add‘ button.
In the new menu that opens, click on ‘Material‘.
Save the material, and open it by double-clicking on it.
Beginner Material Nodes in Unreal Engine
I’ll cover more about Materials in future lessons, but for now, let’s focus on the basics.
Double-click on the Material you created to start editing it by changing three fundamental parameters.
In the ‘Base Color‘ pin, you’ll primarily connect colors and textures.
I’ll teach you about textures in the next section, so let’s start with creating simple colors.
Right-click anywhere on the grid in the Material window and search for ‘Constant3Vector‘, or use the shortcut ‘3 + left click‘.
If you double-click on the black rectangle or change the XYZ values, you can adjust the color of the node.
Connect this node to the Base Color, and press ‘Apply‘ in the top menu bar to make your material change colors.
Metallic and Roughness
The ‘Metallic‘ pin lets Unreal Engine know if your material is metallic or not.
In game development, we often use only 0 or 1 for the metallic value because it makes things simpler.
This value tells the computer if a material looks like metal (1) or not like metal (0).
In real life, things are usually either metallic or not, so using just 0 or 1 helps the computer understand and show this in a game or animation.
On the other hand, ‘Roughness‘ defines how smooth our material is and how reflections behave.
If roughness is set to 1, the material will be completely matte or diffuse. If it is set to 0, it will be like a mirror reflection. Here, it is perfectly fine to use decimal values, as materials can be just a bit reflective.
Right-click anywhere on the grid in the Material window and search for ‘Constant‘, or use the shortcut ‘1 + left click‘, to set up the value for the Metallic and Roughness inputs.
Texture Materials in Unreal Engine
Working with colors is fine, but especially in game development, you will be using a lot of textures. So, let’s learn the basics of using them to create materials.
For this example, let’s use the ‘T_Brick_Clay_New’ textures in the Starter Content. But you can use any other texture you imported into Unreal Engine. To import a texture, just drag and drop it from your computer.
Usually, textures come in two files: the Diffuse Texture and the Normal Map.
- Diffuse typically refers to the base color or albedo of a material.
- The normal map is the one that adds a depth effect to the material. If you download a texture and it doesn’t have a normal map, you’ll need to create one yourself if you want that effect.
Sometimes, there’s also a third file for roughness, ambient occlusion, or more, depending on how detailed the texture needs to be.
Occasionally, textures are combined into a single file to save space on the disk and memory. In those cases, you’ll need to connect the correct channel to the right input
For example, in this case, you need to connect the R channel to Roughness and G to Ambient Occlusion, but this depends on how the person created the texture.
What is an DpRF, ORDp or DRO texture?
When using textures from others, like Megascans, it’s helpful to check how the texture is named, especially at the end, as it gives you a clue about what is in each channel of the texture.
The order of these in the filename is always RGBA, meaning the first abbreviation is packed into the red channel, the second into the green, and so on:
- AO or O: Ambient Occlusion
- C: Color, Albedo or Diffuse
- Ca: Cavity
- Cu: Curvature
- D or Dp: Displacement Map or World Displacement
- F: Fuzz
- M: Metallic
- R: Roughness
As you can see, materials can become quite complicated very quickly, so in the future, I will create a learning section dedicated only to materials.
I hope it helps! Keep creating!