Skip to content

Instantly share code, notes, and snippets.

@ayamflow
Last active May 31, 2022 18:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayamflow/b0bbf96ed9b33667f39fd1008c2cb483 to your computer and use it in GitHub Desktop.
Save ayamflow/b0bbf96ed9b33667f39fd1008c2cb483 to your computer and use it in GitHub Desktop.
Cheap parabola in GLSL
// Doesn't require pow()
// Not smoothed i.e. like a triangle function
float linearParabola(float x) {
return 1.0 - abs(x * 2.0 - 1.0);
}
// Slightly smoothed, no math function
float parabola(float x) {
return 4.0 * x * (1.0 - x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment