From d48042a258d1e9ba79f9eb3a71e54ed6d731c6f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 18 Dec 2011 19:41:14 +0100 Subject: [PATCH] use correct luminance calculation for greyscale --- scene-fragment.glsl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scene-fragment.glsl b/scene-fragment.glsl index 22463c16c2..4b5424be16 100644 --- a/scene-fragment.glsl +++ b/scene-fragment.glsl @@ -12,10 +12,8 @@ void main() { tex.a += float(u_forceAlpha); - if( saturation != 1.0 ) { - vec3 desaturated = tex.rgb * vec3( 0.30, 0.59, 0.11 ); - desaturated = vec3( dot( desaturated, tex.rgb )); - tex.rgb = tex.rgb * vec3( saturation ) + desaturated * vec3( 1.0 - saturation ); + if (saturation != 1.0) { + tex.rgb = mix(vec3(dot( vec3( 0.30, 0.59, 0.11 ), tex.rgb )), tex.rgb, saturation); } tex *= modulation;