- add gl_satformula == 2 - an optional 'more accurate' desaturation

This commit is contained in:
Rachael Alexanderson 2022-03-16 13:32:56 -04:00
parent fe4c95a03e
commit 6cc03aba16

View file

@ -12,6 +12,8 @@ vec4 ApplyGamma(vec4 c)
vec3 valgray;
if (GrayFormula == 0)
valgray = vec3(c.r + c.g + c.b) * (1 - Saturation) / 3 + c.rgb * Saturation;
else if (GrayFormula == 2) // new formula
valgray = mix(vec3(pow(dot(pow(vec3(c), vec3(2.2)), vec3(0.2126, 0.7152, 0.0722)), 1.0/2.2)), c.rgb, Saturation);
else
valgray = mix(vec3(dot(c.rgb, vec3(0.3,0.56,0.14))), c.rgb, Saturation);
vec3 val = valgray * Contrast - (Contrast - 1.0) * 0.5;