#ifdef GL_ES precision mediump int; precision mediump float; #endif #define USE_OGRE_FROM_FUTURE #include SAMPLER2D(inRTT, 0); OGRE_UNIFORMS( uniform vec2 texelSize; ) MAIN_PARAMETERS IN(vec2 oUv0, TEXCOORD0) MAIN_DECLARATION { vec4 LUMINENCE_FACTOR = vec4(0.2125, 0.7154, 0.0721, 0.0); vec4 accum = vec4(0.0, 0.0, 0.0, 0.0); // Get colour from source accum += texture2D(inRTT, oUv0 + texelSize * vec2(-1.5, -1.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2(-0.5, -1.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 0.5, -1.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 1.5, -1.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2(-1.5, -0.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2(-0.5, -0.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 0.5, -0.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 1.5, -0.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2(-1.5, 0.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2(-0.5, 0.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 0.5, 0.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 1.5, 0.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2(-1.5, 1.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2(-0.5, 1.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 0.5, 1.5)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 1.5, 1.5)); // Adjust the accumulated amount by lum factor float lum = dot(accum, LUMINENCE_FACTOR); // take average of 16 samples lum *= 0.0625; gl_FragColor = vec4(lum, lum, lum, 1.0); }