#ifdef GL_ES #define LOWP lowp precision mediump float; #else #define LOWP #endif varying LOWP vec4 vColor; varying vec2 vTexCoord; uniform sampler2D u_texture; uniform sampler2D u_texture1; uniform float exposure; void main() { vec3 origColor = texture2D(u_texture, vTexCoord).rgb; vec3 blurredColor = texture2D(u_texture1, vTexCoord).rgb; const float gamma = 2.2; origColor += blurredColor; // additive blending // tone mapping vec3 result = vec3(1.0) - exp(-origColor * exposure); // also gamma correct while we're at it result = pow(result, vec3(1.0 / gamma)); gl_FragColor = vec4(result, 1.0); }