However, Hermite interpolation it links to is different from Cubic Hermite spline interpolation; they're two different articles.
These are nested subjects. That is, "Cubic Hermit interpolation" is a specific kind of "Hermite interpolation", just as a polygon is a specific kind of polytope.
Hermite interpolation is itself a particular scheme for doing polynomial interpolation. And polynomial interpolation is the construction of a polynomial (of the lowest possible degree) that passes through all of a given set of points in a field.
How this maps to smoothstep
is as follows. For a given pair of start/end values, smoothstep
defines a function f(X)
, where X is the given value. If we plot Y = f(X)
on a graph, we get a function whose Y range is [0, 1] and its X range is [-inf, inf].
Now, when X is less than the start value, Y is always 0. When X is greater than the end value, Y is always one. When X is between those two values, it varies from 0 towards the start and 1 towards the end.
What that means is that we have 2 points in 2D space: (start, 0) and (end, 1). If we presume that start is 0 and end is 1 (we can linearly rescale the X value to map [start, end] to the [0, 1] range), then our points are (0, 0) and (1, 1).
Given this, we can perform Hermite interpolation between those two points. However, cubic Hermite interpolation requires 4 points: two points in space that act as the end points the curve must match and two first-derivatives which the curve must match at those points.
The first-derivatives are implied here by the nature of the smoothstep function. That is, the derivatives are chosen to be "smooth", relative to the flat parts of the function (ie: outside the X range of [0, 1]).
The derivatives can be defined in terms of 2D vectors that are tangent to the curve at those points, flowing in the direction of the curve from start to end. Since the values less than 0 are going to be a flat value of 0, and the values greater than 1 will have a flat value of 1, it makes sense that the tangents are also flat. So the two tangents are both (1, 0).
So our 4 Hermite interpolation positions are:
0th Derivative |
1st Derivative |
(0, 0) |
(1, 0) |
(1, 1) |
(1, 0) |
The rest is just plugging those numbers into the cubic Hermite interpolation formula and reducing the result. $\boldsymbol{p}_0$ and $\boldsymbol{p}_1$ are the start/end points, and $\boldsymbol{k}_0$ & $\boldsymbol{k}_1$ are the two tangents:
$$
\boldsymbol{f}(t) = \left(2t^3 - 3t^2 + 1\right) \boldsymbol{p}_0 + \left(t^3 - 2t^2 + t\right) \boldsymbol{m}_0 + \left(-2t^3 + 3t^2\right) \boldsymbol{p}_1 + \left(t^3 - t^2\right) \boldsymbol{m}_1
$$
The X and Y components are:
$$
\begin{eqnarray*}
f(t)_x &=& \left(2t^3 - 3t^2 + 1\right) p_{0x} + \left(t^3 - 2t^2 + t\right) m_{0x} + \left(-2t^3 + 3t^2\right) p_{1x} + \left(t^3 - t^2\right) m_{1x}\\
f(t)_y &=& \left(2t^3 - 3t^2 + 1\right) p_{0y} + \left(t^3 - 2t^2 + t\right) m_{0y} + \left(-2t^3 + 3t^2\right) p_{1y} + \left(t^3 - t^2\right) m_{1y}
\end{eqnarray*}
$$
If you insert the zeros and ones, then you get things reduced to:
$$
\begin{eqnarray*}
f(t)_x &=& (t^3 - 2t^2 + t) + (-2t^3 + 3t^2) + (t^3 - t^2)\\
&=& (t^3 - 2t^3 + t^3) + (-2t^2 + 3t^2 - t^2) + t\\
&=& t\\
f(t)_y &=& -2t^3 + 3t^2
\end{eqnarray*}
$$
We're not actually looking for $f(t)$ however; we're looking for our function f(x) that yields Y. Because $t$ and $f(t)_x$ are the same however, that means $f(t)_y$ is just the $f(x)$ that we're looking for.
Does $-2x^3 + 3x^2$ look familiar? It's just a different form of t * t * (3.0 - 2.0 * t)
. Which is what smoothstep
returns when t
is between 0 and 1.
QED