smoothstep
#Hermite_interpolation #ヘヴィサイドの階段関数 #数学
smoothなヘヴィサイドの階段関数
しきい値a, b間の値を、3次Hermite interpolation $ -2t^3 + 3t^2 で補間する
一回微分しても連続
code:cpp
float smoothstep(float a, float b, float t) {
float x = saturate((t - a) / (b - a));
return x * x * (3.0 - 2.0 * x);
}
傾きの最大は$ t = 0.5のときであり、その値は$ 1.5
初出はRenderMan Shading Languageらしい
See also:
linearstep
smootherstep
smooteststep
登場作品
RenderMan Shading Language: smoothstep(min, max, value)
GLSL: smoothstep(edge0, edge1, x) https://registry.khronos.org/OpenGL-Refpages/gl4/html/smoothstep.xhtml
HLSL: smoothstep(min, max, x) https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-smoothstep
Three.js: MathUtils.smoothstep(x, min, max) https://threejs.org/docs/#MathUtils..smoothstep
他と順序が違うので注意!
Houdini VEX: smooth(value1, value2, amount)
Hermite interpolationとは明記されておらず、挙動はちょっと違うかも
Unity: Mathf.SmoothStepはこのsmoothstepとはまるで別物なので注意
Desmos
https://gyazo.com/9198446ee1cfe8df5e7919414911e16c
https://www.desmos.com/calculator/ehlqhvpybz