Linear interpolation (Lerp)

In Godot’s shader language there is no lerp function as there is in GDScript (or in some other shader languages). Instead there is the mix() function which is practically the same thing. It interpolates from valueA to valueB with t as the weight, 0 being valueA and 1 being valueB.

mix(valueA, valueB, t);


The step() function takes in a value and returns either 0.0 or 1.0 depending on if it is over or under a limit.

step(limit, value);

Smooth step

Smooth step is very similar to step, but instead of returning only 0.0 or 1.0 the returned value will be 0.0 if it is below a first limit and 1.0 if it is above a second limit. Between the limits, the value will be smoothly interpolated (using a Hermite smooth interpolation, which is why you might come across this name when smooth step is mentioned).

In Godot you will do this with the smoothstep() function. In some tutorials, you might see x = f * f * (3.0 - 2.0 * f) or similar. This is the same thing and is what smoothstep() does under the hood.

smoothstep(limit1, limit2, value);

Read more about Mix, Step and Smooth step at The Book of Shaders.