Skip to content

Instantly share code, notes, and snippets.

@raphaelameaume
Created September 10, 2020 10:01
Show Gist options
  • Save raphaelameaume/dec007c52fa293cf787d0391b5160f10 to your computer and use it in GitHub Desktop.
Save raphaelameaume/dec007c52fa293cf787d0391b5160f10 to your computer and use it in GitHub Desktop.
Map a value from one value to another in glsl
float mapRange(float value, float low1, float high1, float low2, float high2) {
return low2 + (value - low1) * (high2 - low2) / (high1 - low1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment