Created
May 19, 2023 18:36
-
-
Save Zi7ar21/d3dab18f2e86d117592a8c9973516505 to your computer and use it in GitHub Desktop.
Smoothstep but less continuous
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float notsosmoothstep(float x, float edge0, float edge1) { | |
x = (x - edge0) / (edge1 - edge0); // [edge0, edge1] -> [0, 1] | |
x = x < 0.0 ? 0.0 : x; // max(x, 0) | |
x = x > 1.0 ? 1.0 : x; // min(x, 1) | |
x -= 0.5; | |
return 2.0*(-x*abs(x)+x)-0.5; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment