1 #define rendered texture0
3 struct ExposureParams {
4 float compensationFactor;
7 uniform sampler2D rendered;
8 uniform mediump float bloomStrength;
9 uniform ExposureParams exposureParams;
12 varying mediump vec2 varTexCoord;
14 centroid varying vec2 varTexCoord;
17 #ifdef ENABLE_AUTO_EXPOSURE
18 varying float exposure; // linear exposure factor, see vertex shader
23 vec2 uv = varTexCoord.st;
24 vec3 color = texture2D(rendered, uv).rgb;
25 // translate to linear colorspace (approximate)
26 color = pow(color, vec3(2.2));
28 color *= exposureParams.compensationFactor * bloomStrength;
30 #ifdef ENABLE_AUTO_EXPOSURE
34 gl_FragColor = vec4(color, 1.0); // force full alpha to avoid holes in the image.