#ifdef GL_ES precision mediump int; precision mediump float; #endif #define USE_OGRE_FROM_FUTURE #include SAMPLER2D(inRTT, 0); SAMPLER2D(inLum, 1); SAMPLER2D(inKey, 2); #include OGRE_UNIFORMS( uniform vec2 texelSize; ) MAIN_PARAMETERS IN(vec2 oUv0, TEXCOORD0) MAIN_DECLARATION { vec4 avgLum = texture2D(inLum, vec2(0.5, 0.5)); vec4 Key = texture2D(inKey, vec2(0.5, 0.5)); vec4 accum = vec4(0.0, 0.0, 0.0, 0.0); accum += texture2D(inRTT, oUv0 + texelSize * vec2(-1.0, -1.0)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 0.0, -1.0)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 1.0, -1.0)); accum += texture2D(inRTT, oUv0 + texelSize * vec2(-1.0, 0.0)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 0.0, 0.0)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 1.0, 0.0)); accum += texture2D(inRTT, oUv0 + texelSize * vec2(-1.0, 1.0)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 0.0, 1.0)); accum += texture2D(inRTT, oUv0 + texelSize * vec2( 1.0, 1.0)); // take average of 9 samples accum *= vec4_splat(0.1111111111111111); gl_FragColor = toneMap(accum, avgLum, Key); }