4
Materials in Unreal E ngine
4.1 INTRO DUCTION
I
N order to achieve the beauty and realism that Unreal Engine 4 has to offer, it
is necessary for you to master creating mate rials. Do you want to create hyper-
realistic scenes that are so hig hly deta iled that the pla yer feels as if they are actually
inside the game? Need to make stunning animated explosio ns that let forth a visual
shockwave? Perhaps you need to create simple cartoon-like cell-shaded characters
sailing across a vast ocean. Each of these will require materials.
When it comes to achieving the stunning visual potential that Unreal Engine 4
has to offer, the Material Editor is perhaps the most important engine component.
The Material Editor allows the user to create and edit materials driving the visual
elements in a game or simulation and con trolling the final visual look of all static
meshes, characte rs, environmen ts, particle effects, and more. In this chapter we will
explore what materials ar e, what they are ma de of, and how to start making your own
materials in the Un real Engine 4 Material Editor.
FIGURE 4.1: A simple mesh object with no material (left) and with a material (right).
4.2 ANATOMY OF A MATERIAL
Depending on your familiarity with g ame engines, you may or may not know what a
material is, exactly. To put it simply, materia ls are a kind of “paint” which is applied
to the surfaces of o bjects within a digital environment. If an object la cks a material in
Unreal E ngine 4, it becomes simply a 3-dimensional low poly mesh with no visible
details. Once a material is app lied, the object becomes more recognizab le . A flat
125
126 Game Development and Simulation with Unreal Technology
mesh can become a mirror, concrete, wood flooring, or even metal grating. Moreover,
materials may give ob je cts effects such as splotches, stains, cracks, rust, or anything
you can think to apply to them to achieve the desired look.
This basic analogy does not accurately convey what materials are and what they
are capable of, however, as it is an oversimplification of the concept. Applying pain t
to a surface controls the co lor of that surface, whereas a material can control the color,
shininess, reflectivity, roughness, m etallic aspects, and much more. They can make
an object gleam in light, look dirty or tarnished, o r give minute details to a character
model such as stubble or scarring. See Figure 4.1 for an example of an object with
(left), and without (right), a material.
For now, it is easiest to think of materials as a visual overlay for an object. How-
ever, once you understand and become more comfortable with materials, how they
work, and how to create them, it will become easier to instead think of materials as
substantial, just as much a part of the object as the m esh. For the time be ing, we will
keep a basic understanding of materials a s an overlay in order to keep the concep t
simple.
(a) (b)
FIGURE 4.2: (a) UV space is a coordinate system that runs from 0 to 1, beginning in the
lower left corner. Each vertex of a surface has values that correspond t o the coordinates of a
texture that is applied to a surface. (b) An example of how the UVs of an object affect how the
texture is applied to the surface of that object.
4.2.1 MAT ERIALS VS. TEXTURES
A simple mistake made by newcomers to game design is the confusion between ma-
terials and textures. Although they are closely related and are often associated, there
are a few key differences between the two. Textures are simply two-dimensional im-
ages consisting of pixels that make up what you can see, whereas materials are a
combina tion o f different elements, often times including one or more textures. While
Materials in Unreal Engine 127
you will inevitably use both materials and textu res, it is important to remember that
they are not the same. When m aterials are create d, textures are utilized to give the
material color, tran sparency, depth, and other effects see Fig ure 4.2.
4.2.2 TEXTURE COORDINATES (UVs)
When applying materials to the surface of objects, the re must be some method by
which Unreal Engine 4 determines where to render each pixel relative to the surface
of the object. This is achieved through use of texture coordinates, or, more commonly,
UVs. Figure 4.2(a) sh ows how a texture is applied to a surface.
UVs g et their name from the variables used to map two-dimensiona l ima ges to
three-dimensional objects, U and V, which run horizontally and vertically along the
coordinate space of an object. Every three-d imensional surface necessarily h as its
own set of UV coordinates. These coordinates are set in a 3D modeling application
such as 3D Stu dio Max or Maya an d can b e manipulated using the Mat erial Ex-
pressions within the Unreal Engine’s Material Editor to c reate un ique effects. See
Figure 4.2(b) for a visual example of a static mesh UV.
FIGURE 4.3: Material Editor in Unreal Engine 4.
4.3 UNREAL MATERIAL EDITO R
The Material Editor in Unreal Engine 4 is where all mater ia ls used by the engin e
are created and edited. Figur e 4.3 shows the Material Editor in Unreal Engine 4.
By d efault, the Material Editor has several d ifferent subdivided areas tha t are used
to facilitate the material creation process.
128 Game Development and Simulation with Unreal Technology
TABLE 4.1
Items in the Toolbar of the Unreal Engine’s Material Editor
Tool Description
Save Saves the material and applies changes to all instances of the material in the editor.
Find in CB Displays the material in the Content Browser.
Apply Applies all changes made to the material in the editor.
Search Searches the Material Expressions for a desired result.
Home Snaps the view of the Graph Canvas back to the Node.
Clean Up Removes any unused Material Expressions.
Connectors Shows or hides unused Connectors.
Live Preview When enabled, allows the Preview Window to live update.
Live Nodes When enabled, allows the Connectors to live update.
Live Update When enabled, allows the Nodes on the Graph to live update.
Stats Shows the material’s stats.
Release Stats Shows the material’s stats in Release.
Built-in Stats Shows the material’s stats within the Engine.
Mobile Stats Shows the material’s stats when run on a mobile device.
Note: The list above is a list of tools in Figure 4.4(a) from left to right.
4.3.1 THE TOOLBAR
Located at the top of the Material Editor view, the Toolb ar, shown in Figure 4.4(a),
contains a few useful tools that can be utilized to n avigate and preview your materials.
Table 4. 1 presents a list of options included in the Toolbar with a short description
of what each tool will do .
4.3.2 PREVIEW WINDOW
The Preview Window (Figure 4.4(b)) shows a preview of the final material ap-
plied to the users choice of polygon. The available polygon options are a Cylinde r,
Sphere, Plane, or Cube. To preview the look of a material on an actual mesh, you
may select the mesh from the Content Browser and use the Teapot to preview the
look in the Preview Window. The preview w indow also has options to toggle a grid
on or off, and to live upd ate the window.
The bottom right corner of the Preview Window shows an XYZ coordinate dis-
play to help orient the user. The Preview Window is designed to give a solid idea
of what the material will look like in the Editor and once deployed in-game.
4.3.3 GRAPH CANVAS
The Graph Canvas is where a ll materials are designed. You will design the network
that will drive every aspect of your material on this canvas. It contains all material
Expressions that are utilized to create the material, and shows how they interact with
each other through the use of connectors (Figure 4.4(c)). The vast majority of work
Materials in Unreal Engine 129
(a)
(b) (c)
FIGURE 4.4: (a) The Toolbar. (b) The Preview Window. (b) The Graph Canvas.
will be done using this window, so it is important for you to familiarize yourself with
navigating about the canvas.
4.3.4 DETA ILS PANEL
The properties of the Material and all Material E xpressions a re displayed in this
window. The Deta ils Menu will change depending on what is selected. To select a
Material Expression, simply click on its respective node. Each Material Expression,
as well as the Material Node, conta ins its own set of unique prop erties, which will
be explained later in the chapter.
4.3.5 EXPRESSIONS PALETTE
The Expre ssions Palette is a list of every Material Expression available fo r use in cre-
ating a material. The list of expressions is separated into a few different categories,
both of which are arranged in alphabetical order. These expressions can also be ac-
cessed by right-clicking on the Graph Canvas. We will explore Material Expressions
in greater detail later in this chapter.
4.4 PHYSICALLY BASED MATERIALS IN UNREAL ENGINE 4
When reading or hearing about Unreal Engine 4, you may have heard the term “Physi-
cally Based Ren dering” or “Physically Based Materials”, and may wonder what these
terms mean. To put it simply, Physically Based Materials are m aterials that are based
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.214.27