Language:
Page Info
Tags:
Skill Level:
Engine Version:

Essential Material Concepts

Choose your OS:

IntroToMaterialsHeader.png

Materials are one of the most critical aspects for achieving the look you want for your objects and levels. This document serves as a quick and high-level way to get started creating your own Materials.

If you are already familiar with Material creation from previous iterations of the Unreal Engine, then you may be interested in the Quick Start Guide, which quickly shows off the key properties you need to know to make the most of our physically-based Material system!

Material Expression Nodes and Networks

The first and most important thing to know about Materials is that they are constructed not through code, but via a network of visual scripting nodes (called Material Expressions) within the Material Editor. Each node contains a snippet of HLSL code , designated to perform a specific task. This means that as you construct a Material, you are creating HLSL code through visual scripting.

WoodFloor.png

In this case, we have a very simple network defining a hardwood floor. However, Material Expression networks need not be so simple. It is common to have some materials that have many dozens of Material Expression nodes within them.

You can find documentation on all of the available Material Expressions in the Material Expression Reference .

Working with Colors and Numbers

As you may know, color - in terms of digital imagery - is broken in to 4 primary channels. These are:

R - Red

G - Green

B - Blue

A - Alpha

As with all digital images, for each pixel, the value of any of these channels can be represented by a number. Much of the work of a Material is simply manipulating these numbers based on a series of circumstances and mathematical expressions.

Materials use floating point values to store color data. This generally means that values for each channel will range from 0.0 to 1.0, instead of 0 to 255 as they do in some image editing applications. It is important to note that you can always overdrive values, which will in some cases result in special behaviors. For instance, if sending color into the Emissive input of a Material, which causes a glow, then values greater than 1.0 will increase the glow brightness.

When thinking about Materials in UE4, keep in mind that many expressions operate independently on each color channel. For example, the Add node takes two inputs and adds them together per channel. If you add together two RGB colors (3-channel vector values), then the output color will be: (Red1+Red2, Green1+Green2, Blue1+Blue2).

Red 1 + Red 2 = Red 3

Green 1 + Green 2 = Green 3

Blue 1 + Blue 2 = Blue 3

Nodes that perform per-channel operations generally need inputs that have the same number of channels. For example, you can Add an RGB color to another RGB color, but you cannot add an RGBA (4-channel) color to a RGB (3-channel) color, because the RGB color does not have an alpha channel. This causes an error and the Material will not compile. The exception to this rule is when one of the inputs is a single-channel (scalar) value. When this happens, the value of the scalar is simply applied to all of the other channels. For example:

  • If adding the RGB value (0.35, 0.28, 0.77) to the scalar value 1.0, the result would be:

    0.35 + 1.0 = 1.35

    0.28 + 1.0 = 1.28

    0.77 + 1.0 = 1.77

Textures

In the case of Materials, textures are simply images that provide some sort of pixel-based data. This data may be the color of an object, how shiny it is, its transparency, and a variety of other aspects. There is an old-school mode of thought that "texturing" is how you apply color to your game models. While the process of creating textures is still critical, it is important to think of textures as a component of Materials, and not as the end result themselves.

A single material may make use of several textures that are all sampled and applied for different purposes. For instance, a simple material may have a Base Color texture, a Specular texture, and a normal map. In addition, there may be a map for the Emissive and Roughness stored in the alpha channels of one or more of these textures.

You can see that, while these all share the same layout, the colors used are specific to the purpose of the texture.

Once created and imported into Unreal Editor, textures are brought into a Material by way of special Material Expression nodes, such as Texture Sample nodes. You can see these in the hardwood floor example above. These nodes make a reference to the texture asset, which exists outside the Material and can be found separately in the Content Browser. Unlike some 3D applications, there is no way for a Material to contain its textures.

For more information on textures and texture creation, please see the Textures documentation.

Properties and Inputs

Much of what you can do with Materials is driven by the various properties you set on the Material itself, as well as how you create and connect the Material Expression node network that defines it. Before you can truly unleash the power of the Unreal Engine's Materials system, it would be a tremendous benefit to look over the properties and inputs available. These can be found below:

Material Properties Material Inputs

Applying Materials to Surfaces

The way in which you apply Materials varies a bit with the type of surface.

Meshes

Applying a Material to a Mesh (Static, Dynamic, or Skeletal) can be handled in many ways. Simply use the Materials element slot located in the properties for the mesh. These can be found in the Details panel when a mesh is selected in the level, or by right-clicking on a mesh and choosing Properties from the context menu. You will also find them within various editors, such as the Static Mesh Editor or the Persona Skeletal Mesh Editor.

  1. Select the Mesh to which you want to apply the Material.

    BoxSelected.png

  2. In the Details panel, click the arrow on the Material Element dropdown. This will show all of the available Materials in your project, and is searchable using the search bar.

    MaterialDetails.png MaterialDropdown.png GreenBox.png

  3. Alternatively, you may choose the desired Material in the Content Browser and then click the arrow button to apply it.

    UseInContentBrowser.png

If you want a material to become the default for a given Mesh, be sure to set the Material in that Mesh's properties, either by right-clicking and choosing Properties from within the Content Browser or by double-clicking the Mesh in the Content Browser and setting the Material using the asset editor (such as the Static Mesh Editor or Persona) that appears.

Remember, if you change a Material from an asset editor or from the Content Browser, that change affects the asset itself. If you change it using the details of a Mesh already placed in the scene, then it only affects the placed copy of the Mesh.

Brush Surfaces

Applying a Material to a Brush surface is a simple process:

  1. Select a Material from the Content Browser.

    MaterialSelected.png

  2. Click on the Brush surface to which you wish to assign the Material.

    BoxPanelSelected.png

  3. In the Details panel, click the ArrowButton.png button. Pressing this button will apply the Material to the Brush surface.

    AddingMaterialToBox.pngRedOnBox.png

Tags