Last active
May 22, 2021 12:30
-
-
Save behreajj/c9add0366340b670210005e9cacb82ca to your computer and use it in GitHub Desktop.
Linear Standard Revised
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
vector le(vector a, float b) { | |
return vector(a[0] <= b, a[1] <= b, a[2] <= b); | |
} | |
vector gt(vector a, float b) { | |
return vector(a[0] > b, a[1] > b, a[2] > b); | |
} | |
color sRgbTolRgb(color standard) { | |
return select(pow((standard + 0.055) / 1.055, 2.4), | |
standard / 12.92, | |
le(standard, 0.04045)); | |
} | |
color lRgbTosRgb(color linear) { | |
return select(pow(linear, 1.0 / 2.4) * 1.055 - 0.055, | |
linear * 12.92, | |
le(linear, 0.0031308)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment