Talk:Smoothstep

Inverse Smoothstep (cubic hermite)
I think it's worth mentioning that the inverse of the popular cubic smoothstep, which is useful when doing certain operations in computer graphics, is


 * $$\operatorname{InvS}_2(x) = 1/2 - sin(asin(1-2x)/3)$$

and in GLSL: (I derived this one myself while working on a project in 2017, no need for credit). An example of it in action is here: https://www.shadertoy.com/view/MsSBRh — Preceding unsigned comment added by Inigo.quilez (talk • contribs) 06:09, 11 February 2019 (UTC)

"It is claimed"...?
"It is claimed in both the MSDN and OpenGL documentation that the function has been implemented using Hermite interpolation."

I'm not sure what this means. The equation is given right there in the code snippet, and yes, that is cubic Hermite interpolation. So what does it mean to say that they "claim to implement it using cubic Hermite interpolation?" I believe it would be more useful to just confirm that the equation shown is the Hermite cubic interpolating polynomial, with the constraints that the endpoints are 0 and 1, and the derivatives at the endpoints are both zero. I guess if nobody comments, I'll make this change. Fletcherdunn (talk) 03:16, 25 August 2009 (UTC)

Stale Link
AMD Siggraph2003 ppt file has either moved, or has been deleted? —Preceding unsigned comment added by 173.174.83.212 (talk) 22:14, 10 August 2010 (UTC)

saturate/clamp helper function consistency?
It would be more clear if the code for the smoothstep and smootherstep reference implementations used the same helper function. Currently smoothstep uses saturate(value), while smootherstep uses clamp(value, 0, 1), which does exactly the same thing. — Preceding unsigned comment added by 70.36.63.75 (talk) 19:00, 12 July 2013 (UTC)

General Form of Smoothstep Equations
Would it be worth noting that all smoothstep equations can be generalized as:


 * $$\operatorname{S}_a(x) = \sum_{n=0}^a (-1)^n\binom{a + n - 1}{n}\binom{2a - 1}{a - n - 1}x^{a + n}$$

where a is the degree of smoothness with larger values of a giving steeper smoothstep equations. Evaluating this function for different values of a gives:


 * $$\operatorname{S}_1(x) = x$$


 * $$\operatorname{S}_2(x) = 3x^2 - 2x^3$$


 * $$\operatorname{S}_3(x) = 10x^3 - 15x^4 + 6x^5$$


 * $$\operatorname{S}_4(x) = 35x^4 - 84x^5 + 70x^6 - 20x^7$$


 * $$\operatorname{S}_5(x) = 126x^5 - 420x^6 + 540x^7 - 315x^8 + 70x^9$$

For any value a where a > 0, this generalization will smoothly interpolate from 0 to 1 for any value x on the interval 0 ≤ x ≤ 1 while retaining the property Sa(0.5) = 0.5. It may be useful for those trying to find higher order smoothstep equations without having to solve increasingly complex systems of unknown variables.

138.247.214.47 (talk) 21:14, 5 April 2016 (UTC)


 * I believe the most generalized way to present this smoothstep polynomial function is in terms of an odd-symmetry, odd-order polynomials about zero, as explained in this Stack Exchange question and answer. It has to be equivalent to the Hermite polynomial of the same order because it also shows continuity of the function and as many derivatives as possible. I do not know of a published article that presents this, so I am not sure how qualified this mathematical analysis would be for this article. 96.237.136.210 (talk) 04:16, 19 December 2016 (UTC)

There is a broken equation in the article.
It's in the section on the 5th order equation:


 * Applying the desired values for the second derivative of the function at both endpoints we get:
 * $$\begin{alignat}{15}

f''(0) &&\; = \;&& 0 \;\;\;\;&& \Rightarrow &&\;\;\;\;     0 \;&& + &&\;      0 \;&& + &&\;     0 \;&& + &&\; 2 a_2 \;&& = \;&& 0 & \\ f''(1) &&\; = \;&& 0 \;\;\;\;&& \Rightarrow &&\;\;\;\; 20 a_5 \;&& + &&\; 12 a_4 \;&& + &&\; 6 a_3 \;&& + &&\; 2 a_2 \;&& = \;&& 0 & \end{alignat}$$

I don't want to slug through this to fix the equation. 96.237.136.210 (talk) 04:06, 19 December 2016 (UTC)


 * Evidently it renders fine in the talkpage. It displays in red letters on the main page as:
 * Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "/mathoid/local/v1/":): {\begin{alignedat}{15}f(0)&&\;=\;&&0\;\;\;\;&&\Rightarrow &&\;\;\;\;0\;&&+&&\;0\;&&+&&\;0\;&&+&&\;2a_{2}\;&&=\;&&0&\\f(1)&&\;=\;&&0\;\;\;\;&&\Rightarrow &&\;\;\;\;20a_{5}\;&&+&&\;12a_{4}\;&&+&&\;6a_{3}\;&&+&&\;2a_{2}\;&&=\;&&0&\end{alignedat}}


 * So I dunno what to do. 96.237.136.210 (talk) 04:08, 19 December 2016 (UTC)

I would like to modify and clean up the
Generalization of higher-order equations=== section ==

The math appears to be correct and was just proven recently at the Math Stack Exchange;


 * $$\operatorname{S}_a(x) = \sum_{n=0}^{a-1} \binom{-a}{n}\binom{2a - 1}{a - n - 1}x^{a + n}$$

I want to substitute $$a \leftarrow N+1$$, everywhere except in the subscript where $$a \leftarrow N$$. So the expression will come out as:


 * $$\begin{align}

\operatorname{S}_N(x) &= x^{N+1} \sum_{n=0}^{N} \binom{N+n}{n} \binom{2N+1}{N-n} (-x)^{n} \qquad N \in \mathbb{Z} \ge 0 \\ &= \sum_{n=0}^{N} (-1)^n \binom{N+n}{n} \binom{2N+1}{N-n} x^{N+n+1} \\ &= \sum_{n=0}^{N}       \binom{-N-1}{n} \binom{2N+1}{N-n} x^{N+n+1} \\ \end{align}$$

and the 7 examples will be:


 * $$\begin{align}

\operatorname{S}_0(x) &= x \\ \operatorname{S}_1(x) &= -2x^3 + 3x^2 \\ \operatorname{S}_2(x) &= 6x^5 - 15x^4 + 10x^3 \\ \operatorname{S}_3(x) &= -20x^7 + 70x^6 - 84x^5 + 35x^4 \\ \operatorname{S}_4(x) &= 70x^9 - 315x^8 + 540x^7 - 420x^6 + 126x^5 \\ \operatorname{S}_5(x) &= -252x^{11} + 1386x^{10} - 3080x^9 + 3465x^8 - 1980x^7 + 462x^6 \\ \operatorname{S}_6(x) &= 924x^{13} - 6006x^{12} + 16380x^{11} - 24024x^{10} + 20020x^9 - 9009x^8 + 1716x^7 \\ \end{align}$$

and, finally, to change the $$f(x)$$ in previous sections to their appropriate $$\operatorname{S}_N(x)$$ for consistency throughout the article.

This will only improve consistency in the article. I could not find a reference for inclusion of the generalized Smoothstep, but we were able to prove it at the math StackExchange. I actually think we could bump the generalized definition to the lede of the article and maybe include a hatted section with the "smooth" properties and proof. There is some work involved and I will not begin to do this if someone objects strongly. 173.48.64.110 (talk) 21:41, 29 April 2017 (UTC)

N?
Where in this article is "N" defined? 192.150.204.8 (talk) 10:06, 19 December 2017 (UTC)

smootherstep not in referenced book
The reference provided for smootherstep ("Texturing and Modeling, Third Edition: A Procedural Approach") seems to not contain anything about smootherstep (or a 5th-order polynomial with a different function name) at all, but only smoothstep from this article's intro section. Does anyone know an alternative reference for smootherstep? Bigfootsbigfoot (talk) 09:42, 20 April 2018 (UTC)
 * https://doi.org/10.1145/566654.566636 "Improving noise" by Ken Perlin, from 2002, https://mrl.nyu.edu/~perlin/paper445.pdf for Full text. He mentioned this on some presentations earlier, like in 1999 or 1998. It is not huge discovery (these polynomials are known for 150 years), just application.

My math was embarrassingly wrong. Sincere apologies to @Inigo.quilez.