故あってsmoothstepという関数がなにをしているのか調べてみた。
仕様書によると、Hermite interpolationというのをやってくれるようだ。(読み方がわからない。)
Returns 0.0 if x less than or equal to edge0 and 1.0 if x greater than or equal to edge1 and > performs smooth Hermite interpolation between 0 and 1 when edge0 < x < edge1. This is useful in cases where you would want a threshold function with a smooth transition.
仕様書通りにJavaで実装してみる。
public static float smoothstep(float edge0, float edge1, float x) {
float t = clamp((x - edge0) / (edge1 - edge0), 0, 1);
return t * t * (3 - 2 * t );
}
ふむ。よくわからない。
いろいろぐぐった結果、グラフをみつけて納得。