210 Game Development and Simulation with Unreal Technology
addition to get my oscillation network to go from 1 to 2 and back. Multiplying
this result by the ember color will make the final ember burn look I wanted to
achieve. You can see the entire network in Figure 4.59 .
In order to control the speed of oscillation we can use the Period prop erty of
the Cosine expression. In our example here we used a value of 4 for the Period.
This makes an entire oscillation to take about 4 seconds in game time. In other
words, the embers go from minimum intensity to the maximum intensity in a
period of a bout 4 seconds.
APPLYING MATERIALS TO THE PROPS
Finally we applied all three materials we created through this Tuto rial to the three
props in the level to see our progression side-by-side.
4.6.2.3 Coordinate Expressions
These expressions
4
utilize the 2D or 3D coordinate systems in the World Space or
Texture Coordinates to enable in te ractions between these coordinate spaces and cer-
tain aspects of the mate rials [9].
You can create effect such as geographically color-coding the geometry, chang ing
the tiling of texture maps on the geometry, and even creating d ynamic materials.
Panner: This expre ssion creates UV coordinates that are panned by the speed. The
Panner has two input channels: Co ordinate and Time, and two properties as de-
scribed below:
TABLE 4.27: Panner Properties
Properties
SpeedX: Specifies the U coordinate to use as the center of rotation.
SpeedY: Specifi e s the V coordinate to use as the ce n te r of ro ta tion.
TABLE 4.28: Panner Inputs
Inputs
Coordinate: Takes the base UV texture coordinates to modify by the
expression.
Time: Takes in the value used to determine the current translation of
texture as determined by its speed along the U and V directions
of the texture coordinates. This is usually connected to the output
4
The contents of this section are adopted from the official UE4 online documentation found at:
https://docs.unrealengine.com/latest/INT/.
Materials in Unreal Engine 211
of a Time expression or a network based on the Time Expression.
However, you may us e a parameter for this input and dynamically
control the value of the parameter throug h Mati n e e or Blueprint
sequences.
Usage Example:
To move the texture on a surface you usually connect the out-
put of a Time expre ssion or a network based on the Time Expression to the
Time channel of the Panner expression. However, you may use a parameter
for this input and dynamically control the value of the parameter through
Matinee or Blueprint sequences. You then connect the output o f this expres-
sion to the UVs input chann el of a Texture Sample expre ssion to move the
texture across the surface on which the material will be applied.
Rotator: This expression creates UV coordinates that are r otated by the speed. The
Rotator ha s two input channels: Coordinate and Time, and three properties as
described below:
TABLE 4.29: Rotator Properties and I nputs
Properties
CenterX: Specifies the U coordinate to use as the cen te r of rota tion.
CenterY: Specifies the V coordinate to use as the center of rotation.
Speed: Specifies the speed to rotate the coordinate. Positive values are
clockwise and negative values are counterclockwise.
Inputs
Coordinate: Takes the base UV texture coordinates to modify by the
expression.
Time: Takes in the value used to determine the current rotation position.
This is usually connected to the output of a Time expression or a
network based on the Time Expression. H owever, you may use a
parameter for this input and dynamically control the value of the
parameter th rough Matinee or Blueprint sequences.
Usage Example: To rotate the texture on a surface, you usually co nnect the out-
put of a Time expre ssion or a network based on the Time Expression to the
Time channel of the Rotator expression. However, you may use a parame-
ter for this inp ut and dyna mically control the value of the param eter thr ough
Matinee or Blueprint sequences. You then connect the output o f this expres-
sion to the UVs input channel of a Texture Sample expression to rota te
the texture.
212 Game Development and Simulation with Unreal Technology
Texture Coordina te: This expressions allows for the manipulation of the UV co-
ordinates of Texture Sample Expressions by outputting a 2-channel vector value.
You can use this expression in conjunction with other Coordinate expressions
such as Panner or Rotator expressions to change the tiling, dynamically mod ify
texture spaces, or operate on the UVs of a mesh.
TABLE 4.30: Texture Coordinate
Properties
Coordinate Index: Specifies the UV Channe l to use .
UTiling: Specifi e s the amo u n t o f tiling in the U d irection.
VTiling: Specifi e s the amo u n t o f tiling in the V direction.
Un Mirror U: If set to T rue, undoes any mirroring in the U direction.
Un Mirror V: If set to True, undoes any mirroring in the V direction.
Example Usa ge 1: To access the second UV ch annel of a mesh, you can cre ate
a Texture Coordinate and set its Coordinate Index to 1 0 is th e first
channel, 1 is the second, 2 is the th ird, and so on. Connect the output of the
expression to the UVs input channel of a Texture Sample expr ession.
Example Usa ge 2: You can app ly different values to the UTiling and VTiling
values of this exp ression and c onnect its output to the UVs input channel
of a Texture Sample expression to change the tiling of its texture. Values
grater than 1 will make the texture smaller, while values smaller than 1 will
make the texture expand along the U, V, or both directions.
Vertext Normal WS: This expression outputs the world space vertex normal. It can
only be used in material inputs that are executed in the vertex shader. An example
of such material is one that is using its World Position Offset cha nnel.
Usage: One example fo r this expression usage is to manipulate the size of an
object through the World Position Offset or the World Displacement
channels. This expression supplied the norm al vector of each vertex in the
world space. By multiplying the outpu t of this expression by a value, you
will be able to push or pull the geometry inwards or outwards along its nor-
mal vector at each vertex, thereby changing the geometry from the material.
This overview of the coordinate expressions in Unreal Eng ine 4 should have pre-
sented a convincing case in proving their power and versatility. In the next hands-on
work, Tutorial 4.6, we will learn how to utilize these expressions in creating aston-
ishing effects with no need for affecting th e geometry.
Materials in Unreal Engine 213
FIND ON THE WEBSITE
To find updates to this tutorial and u pdated instructions about its implementa-
tion on other UE 4 versions, please visit the books companion Website at:
http://www.RVRLAB.com/UE4Book/
TUTORIAL 4.6 Materials with Time Varying Effects II: Moving Tiles
In this tutorial we will learn how to use coordinate expression to crea te dynamic
effects in our materials.
BEFORE YOU PROCEED
Before y ou proceed with this Tutorial, and you have not finished
Tutorial 4.1 o n page 150, please go ahead a nd comple te it. In
order to view the effects w e will create in this Tutoria l, we need
the Demo Room to have been included in our project.
ORGANIZING ASSETS AN D PLACING THE DISPLAY ITEM
We will place a Display Item in the Demo Room and place three meshes on it,
so that we could dem onstrate our creations later.
1. If you have not finished Tutorial 4.1 on pag e 150, please go ahe ad and complete
it. We will nee d the Demo Room to have been included in o ur project.
2. In the Content Browser, look for a folder inside the Demo Room folder called
Blueprints and open it.
3. Drag a copy of Display Item onto the level and place it along a wall. Change its
properties to the f ollowing:
Number: 5-M.
Description: Dynamic Materials . . .
Type: Square-L
4.
In the content b rowser, look for a fo lder called Props and open it.
5. In the Props folder loo k for and find the SM_MatPreviewMesh_02 mesh and
drag it into the Display Item you have already placed in the Demo Room.
6. Rotate, scale, and position the mesh so that it faces outwards from the Display
Item.
7. Alt-Drag the mesh to cr eate two copies of it on the Display Ite m (see Figure 4.36
on page 165). You can alternatively copy and paste the mesh in the editor on the
Display Item.
214 Game Development and Simulation with Unreal Technology
8. Save your level so far.
FIGURE 4.65: The Panels Static Material.
CREATING TH E BASE MATERIAL’S DIFFUSE NETWORK
Great! We now have a display item and three meshe s in the level to dem onstrate
our progress as we go alon g in this tutorial.
9. In the Content Browser, find your materials folder you have created in earlier
tutorials. If you do not have one, Right-click on the Game folder, create a new
folder and call it MyMaterials.
10. Double-c lick on the MyMaterials folder to open it up.
11. Create a New Material in this folder and call it M_Panels_Static.
12. Double-c lick on the newly created M_Panels_Sta tic material to open it in
the Material Editor.
13. The base material we will create now for our M_Panels_Static will be a little
more complicated than the one we created for the base material in Tutorial 4.5.
Figure 4.65 shows the final look of our M _Panels_Static. Notice the hexagonal
tiles, and the g rout between them . We will use four textures for this look, a diffuse
steel texture and its normal map texture, and a hexagonal mask texture and its
normal map texture.
..................Content has been hidden....................

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