smoothstep

taichi_glsl.scalar.smoothstep(x, a=0, b=1)

Perform Hermite interpolation between two values.

smoothstep performs smooth Hermite interpolation between 0 and 1 when a < x < b. This is useful in cases where a threshold function with a smooth transition is desired.

Results are undefined if a >= b.

Parameters
  • a – Specifies the value of the lower edge of the Hermite function.

  • b – Specifies the value of the upper edge of the Hermite function.

  • x – Specifies the source value for interpolation.

Returns

The return value is is computed as:

t = clamp((x - a) / (b - a), 0, 1)
return t * t * (3 - 2 * t)