-
Notifications
You must be signed in to change notification settings - Fork 15
smooth_step
smooth_step - Perform SmoothStep interpolation
float smooth_step( float $edge0, float $edge1, float $x )
smooth_step() returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and performs smooth Hermite interpolation between 0 and 1 when edge0 < x < edge1. This is useful in cases where you would want a threshold function with a smooth transition. This is equivalent to:
t = [[clamp]] ((x – edge0) / (edge1 – edge0), 0, 1);
return t * t * (3 – 2 * t);
edge0 - The leading edge. It can be a scalar or an array.
edge1 - The trailing edge. It can be a scalar or an array.
x - The position at which interpolation is wanted. It can be a scalar or an array.
0 if x falls before edge0, 1 if its falls after edge1, or an interpolated value if it falls between the two. If x, edge0, or edge1 is an array, then return value is also an array, the size of which matches the largest of x, edge0, and edge1.
1.0 and above.
(Language borrowed from OpenGL® ES specification)