diff options
Diffstat (limited to 'examples/live/shaders')
| -rw-r--r-- | examples/live/shaders/vm.glsl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/live/shaders/vm.glsl b/examples/live/shaders/vm.glsl index 185d23a..06319ec 100644 --- a/examples/live/shaders/vm.glsl +++ b/examples/live/shaders/vm.glsl @@ -75,7 +75,8 @@ vec3 vm(uint base, uint len, float t, float x, float y) { case OP_clamp: v = clamp(a, b, c); break; case OP_mix: v = mix(a, b, c); break; case OP_step: v = step(a, b); break; - case OP_smoothstep: v = smoothstep(a, b, c); break; + // GLSL leaves smoothstep undefined for lo > hi; this one is not. + case OP_smoothstep: v = clamp((c - a) / (b - a), 0.0, 1.0); v = v * v * (3.0 - 2.0 * v); break; case OP_atan2: v = atan(a, b); break; case OP_noise: v = noise(vec3(a, b, c)); break; case OP_saw: v = 2.0 * fract(a + 0.5) - 1.0; break; |
