Created
September 10, 2020 10:01
-
-
Save raphaelameaume/dec007c52fa293cf787d0391b5160f10 to your computer and use it in GitHub Desktop.
Map a value from one value to another in glsl
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 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