use correct luminance calculation for greyscale

This commit is contained in:
Thomas Lübking 2011-12-18 19:41:14 +01:00
parent 55c52977b3
commit d48042a258

View file

@ -12,10 +12,8 @@ void main() {
tex.a += float(u_forceAlpha); tex.a += float(u_forceAlpha);
if( saturation != 1.0 ) { if (saturation != 1.0) {
vec3 desaturated = tex.rgb * vec3( 0.30, 0.59, 0.11 ); tex.rgb = mix(vec3(dot( vec3( 0.30, 0.59, 0.11 ), tex.rgb )), tex.rgb, saturation);
desaturated = vec3( dot( desaturated, tex.rgb ));
tex.rgb = tex.rgb * vec3( saturation ) + desaturated * vec3( 1.0 - saturation );
} }
tex *= modulation; tex *= modulation;