Materials in Unreal Engine 245
(a) (b)
FIGURE 4.76: Results of Desaturation: (a) The original texture. (b) The desaturated texture
with Luminance Factor of (R:0.33,G:0.59,B:0.11) and 20% Fraction.
TABLE 4.61: Desaturation
Properties
Luminance Factors: This property specifies the amount of each chan-
nel’s contribution to the desaturated color.
Inputs
Fraction: This input value specifies th e amount of desatu ration to ap-
ply to the input color, or texture. An amount of 0 is used for no
desaturation (full original color), or an amount of 1 is used for full
desaturation (no colors, only grayscale).
Example Usa ge: Use this expression to soften the colors of high contrast colored
textures. You can control how much of th e red, green or blue colors of the
original texture to keep based on the Luminance Factor you can specify.
Figure 4.76(a) shows an original texture applied to the Base Color and the
Emissive Color channels of a material. Figure 4.76(b) shows the same
texture applied to the Base Color and Emissive Color channels after
being desaturated with the L uminance Factor of (R:0.33, G:0.51, B:0.11)
and 20% Fraction.
Distance: This expression c alculates the Euclidean distance between two vectors.
These vectors could represent colors, positions, etc. The expression can take on
vectors with any number of dimensions.
TABLE 4.62: Distance
Inputs
246 Game Development and Simulation with Unreal Technology
A: The first input vector of any dimension.
B: The se c ond input vector of any dimension.
Fresnel: T his expression calculates the amount of falloff based on the dot product of
the surface normal and the v iewer vector. In other words, if the viewer is directly
looking at a surface th e output value is 0. When the viewer is looking at the surface
perpen dicularly, th e fresnel will output a value of 1. T he result of this expression
is clamped to [0 ,1]. Mathematically, let N be the sur face normal, V be the camera
vector, and p be the exp onent value, the Fresnel ou tput is calculated accord ing to
the following equation :
FRES(N,V, p) = (1 N V)
p
(4.24)
In UE4, the Fresnel expression a lso takes into account a Base Reflection
Fraction value, b. This value augments the result of the Normal and Camera
vector dot product to account for the fraction of the light specular reflection on
the surface. A value of 0 for b is equivalent to the above equation, while a value of
1 for Base Reflectio n Fract ion disables the Fresnel. The complete equation
for the Fresnel expression is as follows:
FRES(N, V, p, b) = [1 ((1 b) × (N V))]
p
(4.25)
(a) (b) (c)
FIGURE 4.77: Results of Fresnel Expression: (a) The Fresnel with an exponent of 1. (b) The
Fresnel result with an exponent of 5. (c) The Fresnel network for (a) and ( b).
TABLE 4.63: Fresnel Properties
Properties
Materials in Unreal Engine 247
Exponent: This property specifies how quickly the result falls off. The
value p in equa tions (4.24) and (4.25). Larger valu e s ma ke the result
fall off more quickly and have tighter boundaries.
Base Reflection Fraction: This property specifi e s the amount of specular
reflection if viewed straight on. A value of 1 disables the Fresnel
expression.
TABLE 4.64: Fresnel Inputs
Inputs
Exponent In: Th is in p u t sp e c ifies the fall o f values. It will replace the
Exponent property if connected.
Base Reflection Fraction: This input specifies the fraction o f specular
reflection if viewed straight on. It will replace the Base Reflection
Fraction property if connected.
Normal: This input takes in a 3D vector as the Surface Normal. If you
have used a normal map in the material, you can connect this input
to a Vertex Normal WS expression to account for the normal map
of the object. If this input is not connected, the engine will u se the
Tangent normal of the mesh.
Example Usa ge:
Use this expression to simulate proper and physically accurate
reflection/refraction of reflective and translucent objects. This expression
is widely used to simulate water, glass, and other reflective and refractive
surfaces. Figure 4.7 7(a) and Figure 4.77 (b) show two materials with a Fres-
nel expression with exponent values of 1 and 5, respectively, controlling the
Emissive Color a nd Opacity channels. Figure 4.77(c) shows the network
responsible for this effect.
Noise: This expression creates a procedural noise field. With the many properties
of this expression you can control how the noise field is generated to suit your
application .
TABLE 4.65: Noise
Properties
Scale: This property controls the overall size of the noise cel ls. Lower
numbers make the noise larger.
Quality: This property control s the tradeoff between qu a lity and perfor-
mance. A value of 0 is fast, but with lower quality.
Function: This property controls the type of noi se. There are three o p -
248 Game Development and Simulation with Unreal Technology
FIGURE 4.78: A Noise Expression Example.
tions: Simplex, Perlin, and Grad ient.
Turbulence: This property controls whether to calculate multiple levels
of noise in iterations.
Levels: This property specifies the different levels of noise to combine.
Used when Turbulence is checked.
Output Min: The minimum value of noise output.
Output Max: The maximum value of noise output.
Level Scale: This property controls the scale of individual levels when
Turbulence is active and checked.
Inputs
Position: This input controls th e adjustm e n t of the texture size with a
3D vector.
Filter Width: This input controls how much blur to be appli e d to the
noise texture.
Example Usa ge:
You can connect this expression to a texture or color to add
some randomness to the look of your material (see Figure 4.78).
Rotate About Axis: This expression rotates a three-channel vector input about a
given rotation axis and a pivot point. It is very helpful for animatin g objects using
the World Position Offset channel of the material node.
Materials in Unreal Engine 249
TABLE 4.66: Rotate About Axis
Inputs
Normalized Rotation Axis: This input is the normalized rotation vector
ab out which to rotate the object.
Rotatio n Angle: This input is the angle of rotation. 1 equals full 360
rotation.
Pivot Point: T h is is the three-channel vector used as the pivot poin t for
rotation.
Position: This is a 3D vector representing the position of the object. The
Absolute World Position expression is automatically created to be
connected to this expression to calculate the location of the object
to b e rotated.
Example Usa ge: You can connect this expression to the World Position
Offset c hannel of the material node to rotate the object on which the mate-
rial is applied.
Sphere Mask: This expression outputs a mask value based on a distance c alculation.
If one inp ut is the position of a point and the other inpu t is the center of a sphere
with some radius, the mask value is 0 outside and 1 insid e with so me transition
area. This works on one, two, three and four c omponent vectors.
FIGURE 4.79: The Sphere Mask Expression E xample. In this example the sphere will fade
away as its distance from the camera increases.
TABLE 4.67: Sphere Mask
Properties
Attenuation Radius: This value specifies the radius for the distanc e cal-
..................Content has been hidden....................

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