SmoothStep: Looking for a continuous family of interpolation functions

3.4k Views Asked by At

Background:

SmoothStep is a simple sigmoid-like function defined as S(x) = 3x^2 - 2x^3. It is monotonically increasing from (0, 0) to (1, 1), is rotationally symmetric over that interval, and has flat tangents at both endpoints. This function is useful for generating an interpolation parameter when you would like to ease in and out between an initial and final value.

S(S(x)) will yield a function that has a longer ease-in/ease-out with a sharper transition in the middle, and S(S(S(x))) makes the middle steeper still. The more times the function is nested, the more protracted the ease is and the steeper the tangent at the midpoint becomes.

Question:

I would like to be able to drive this curve from shallow to steep continuously using some kind of 'steepness' parameter, but repeated iteration only allows discrete curves to be evaluated. Additionally, the cost of evaluating the function grows with the number of nested iterations. Is there any similar function which could be tuned continuously in this manner?

3

There are 3 best solutions below

4
On BEST ANSWER

This graph exposes two parameters which allow the curve to be tuned continuously: https://www.desmos.com/calculator/3zhzwbfrxd.

enter image description here

2
On

How about $S(f_c(x))$ where $f_c(x)=(1-c)x+cS(x)$, $c\ge 0$?

2
On

If you are willing to go with parametric representation for your curve, then this is pretty easy to achieve with the following:

$\begin{cases}x(t)=(t^3-2t^2+t)m_0+(-2t^3+3t^2)+(t^3-t^2)m_1 \\y(t)=-2t^3+3t^2 \end{cases}$

You can use $m_0$ and $m_1$ to separately control how strong the curve will go out of $(0,0)$ and into $(1,1)$. The following are two sample pictures: first one with $m_0=m_1=1,2,3$ and second one with $m_0=1,2,3$ and $m_1=1$.

enter image description here enter image description here

The permalinks for generating these pictures are below:

http://fooplot.com/plot/jtu07hy41r
http://fooplot.com/plot/muk7fu5ifi