Skip to content

Instantly share code, notes, and snippets.

@n1ckfg
Forked from companje/map.glsl
Created December 8, 2021 05:12
Show Gist options
  • Save n1ckfg/28bedb4116a8d7f1f9bc009bd9a66dda to your computer and use it in GitHub Desktop.
Save n1ckfg/28bedb4116a8d7f1f9bc009bd9a66dda to your computer and use it in GitHub Desktop.
map() function for GLSL known from Processing & openFrameworks
float map(float value, float min1, float max1, float min2, float max2) {
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment