648 Game Development and Simulation with Unreal Technology
FMOD
This ope ration takes in two inputs an d returns the floating point reminder of their
division. If th e inpu t to this expression is a vector, then the expression outputs the
floor value on a per-channel basis.
Example: The FMod of 3.4 by 2.3 is 1.1.
FRAC
This operation, as the name sugge sts, takes in one input and retu rns its decimal part
- i.e., removes the integer par t of the input value. If the input to this expression is a
vector, then the expression outputs the floor value on a per-channel basis.
Example: The ceiling of 3.4 is .4, and the ceiling of (3.9, 1.27) is (0.9, 0.27).
IF
This expression compares two scalar floating point input values, and three condition
values. Then it passes through one o f the three values from its input condition chan-
nels based on which con dition is true on the two input scalar values.
•
Inputs
A: Ta kes in a scalar floating p oint value as the first input.
B: Takes in a scalar floating point value a s the second input.
A<B: Takes in a value to output if the A is less than B.
A=B: Takes in a value to output if the A is equal to B.
A>B: Takes in a value to output if the A is greater than B.
Example Usage: You can connect a Texture Samp le to th e A input and a scalar
value T h (as the threshold) to the B chann el, then connect three different Con-
stant3Vecto rs to the A<B, A=B, an d A>B to c reate a tri-color m ap based on the
input texture and the threshold value (see Figure 4.51).
LINEAR INTERPOLATE (LERP)
This expression blends between two input value(s) based on a third input value used
as a mask. This can be thoug ht of as a mask to define transitions between two textures,
like a layer mask in Photo shop.
The intensity of the mask Alpha channel determ ines the ratio of color to take from the
two input values. If Alpha is 0 .0/white, the first input is used. If Alpha is 1.0/black,
the secon d input is used. If Alpha is grey (som ewhere between 0.0 a nd 1.0), the
output is a blend be tween the two inputs.
Mathematically speaking, let A be the first input, B be the second input, and 0 ≤
α
≤ 1 be th e mask input. The output O will be calculated according to the following
equation :
O = (1 −
α
) × A +
α
× B (A.8)