Lerp

The Lerp NodeThis Node will interpolate between two values (x, y) based on a position in time (t). When specifying values, you can supply Node Inputs, or add fixed values to the node input boxes, or you can add them through the Inspector window:
The Inspector Window Inputs For The Lerp Node

The Inspector window also permits you to set the LerpType which can be one of the following:

 

String Description
Lerp

This is the basic linear interpolation where the output value will be the interpolation of the input between the min and max values given and clamped to those values if it is outside of them. The formula uses is:

output = x + (y - x) * t

SmoothStep

This is a smoother version of the linear interpolation where the interpolation will be slower the nearer the value is to the min or max values, with the output still being clamped to those values. The formula it uses is the same as the one for Lerp, only t is pre-calculated before being used:

t = t * t * (3 - 2 * t)

 

 

Node Inputs

The Lerp node permits the following inputs:

 

  • X
    This is the minimum value to interpolate from, and can be either a scaler (float) or a vector.

 

  • Y
    This is the maximum value to interpolate to, and can be either a scaler (float) or a vector.

 

  • t
    This is the time value (a scalar) to be used for the interpolation which should be between 0 (where the output will be the minimum value) and 1 (where the output will be the maximum value).

 

Note that when setting these inputs you may use floats or vectors for either of the min/max values. If you supply a float and a vector - in either order for the min or the max - then the float will be treated as if it was the same type as the supplied vector, eg:

(x)min = 1.0
(y)max = vec2(2.0, 3.0)

would be treated as

(x)min = vec2(1.0, 1.0)
(y)max = vec2(2.0, 3.0)

Also note that if you are using two vectors for the inputs, then they both must be the same type. You cannot, for example, use a vec2 as the min and then a vec3 as the max.

 

 

Node Output

The node will output a scalar value if both the inputs are scalars, or a vector if either of the inputs is a vector. The output value(s) will be the interpolated value(s) between the input minimum and maximum based on the time input.