166 Game Development and Simulation with Unreal Technology
We saw three different ways to create Texture Sample expressions. You can
Right-click on the graph editor and search form th em in the search box. You
can also find the expression from the Palette and drag it onto the gra ph editor.
Finally, you can use the shortcut (hold the T key and Left- click on the graph
editor) to place the expression.
Once a Texture Sample expression is placed on the graph editor, you should
assign a texture to it from the Content Browser. To do this you can go to the
Details Panel of the expre ssion, open the drop-down list next to the Texture
section and assign the texture. Alternatively, yo u can select a texture from the
Content Browser, and then click on the Left-Arrow in the Texture sec-
tion to assign the selected texture from the Content Browser. You may also
drag and drop a texture from the Content Browser onto the Text ure section.
To create the look of the br ic k material, we simply connected the RGB ( w hite)
output channel of the Texture Sample expression to the Base Color channel
of our material node.
ADDING THE NORMAL MAP
Normal maps are bitmap (or images) that, for ea ch pixel, conta in a 3D vector
representin g the pixel’s no rmal vector. A normal vector is a vector that points out
of a surface and is perpendicular to the surface. In Computer Graphics, normal
maps are intensively used to cr eate a 3D look on otherwise flat surfaces without
the need to add any complex geometry.
The lighting calcula tion will take into account three vectors: the viewer vector
(also known as the camera vector), th e light vector (also known as the inciden t
vector) and the normal vector to calc ulate the amount of light that is scattered on
a surface and reaches the viewers eyes.
If we do not apply a normal map to our m aterial, all of the pixels on the
surface on wh ic h the material will be applied will have the same dire ction for
their normal. Therefore, the light w ill reflect out uniformly on the surface and
will make it look flat. Applying a normal map to a material will assign different
normal vectors to different locations on the surface. This will make the light rays
that hit different locations on the surface reflect w ith different angles. The end
result is that the surface with normal maps will look 3D, even if its geometry is
perfectly flat. You can see the difference in Figure 4.33(a) (without normals) and
Figure 4.33(b) (with normals applied).
MODIFYING THE NORMAL TO ADD MORE DEPTH
Figure 4.37(a) shows a flat surface with its nor mal vectors unchanged. The black
arrows labeled N are the norm al vectors, the red arrows labeled I are the light
vectors and the blue arrows labeled R are the reflection vectors. Figure 4.37(b)
shows the same flat surface afte r its normals are modified –i.e., they point to-
wards different directions.
In both Figure 4.37(a) and Figure 4.37(b), the light vecto rs are the same to
indicate that the direction of light has not cha nged. Notice that with changes in