Last active
May 22, 2021 12:31
-
-
Save behreajj/76a1b7e1c158e1e4f002a57a67669c84 to your computer and use it in GitHub Desktop.
Mix Lab
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
shader mixLab( | |
color A = 0.0, | |
color B = 1.0, | |
float T = 0.5, | |
color LB = 0.0, | |
color UB = 1.0, | |
output color Color = 0.5) { | |
color aLinear = sRgbTolRgb(A); | |
vector aXyz = lRgbToXyz(aLinear); | |
vector aLab = xyzToLab(aXyz); | |
color bLinear = sRgbTolRgb(B); | |
vector bXyz = lRgbToXyz(bLinear); | |
vector bLab = xyzToLab(bXyz); | |
vector cLab = mix(aLab, bLab, T); | |
vector cXyz = labToXyz(cLab); | |
color cLinear = xyzTolRgb(cXyz); | |
Color = lRgbTosRgb(cLinear); | |
Color = clamp(Color, LB, UB); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment