#ifdef GL_ES precision mediump int; precision mediump float; #endif #define USE_OGRE_FROM_FUTURE #include SAMPLER2D(inRTT, 0); SAMPLER2D(inLum, 1); OGRE_UNIFORMS( uniform float dTime; uniform float AdaptationScale; ) MAIN_PARAMETERS IN(vec2 oUv0, TEXCOORD0) MAIN_DECLARATION { float TauCone = 0.01; float TauRod = 0.04; vec3 Lum = texture2D(inRTT, vec2(0.5, 0.5)).rgb; vec3 oldLum = texture2D(inLum, vec2(0.5, 0.5)).rgb; //determin if rods or cones are active //Perceptual Effects in Real-time Tone Mapping: Equ(7) vec3 sigma = saturate(vec3_splat(0.4)/(vec3_splat(0.04) + Lum)); //interpolate tau from taurod and taucone depending on lum //Perceptual Effects in Real-time Tone Mapping: Equ(12) vec3 Tau = mix(vec3_splat(TauCone), vec3_splat(TauRod), sigma) * vec3_splat(AdaptationScale); //calculate adaption //Perceptual Effects in Real-time Tone Mapping: Equ(5) vec3 tm = (vec3_splat(1.0) - exp(-vec3_splat(dTime)/Tau)); vec3 nlum = oldLum + (Lum - oldLum) * tm; gl_FragColor = vec4(nlum, 1.0); }