29 lines
673 B
Plaintext
Raw Normal View History

2017-09-03 03:29:33 -05:00
#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;
2018-09-03 20:39:26 -05:00
2017-09-03 03:29:33 -05:00
void main() {
vec3 origColor = texture2D(u_texture, vTexCoord).rgb;
vec3 blurredColor = texture2D(u_texture1, vTexCoord).rgb;
2018-09-03 20:39:26 -05:00
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);
2018-09-03 21:59:37 -05:00
2017-09-03 03:29:33 -05:00
}