vec3 Uncharted2Tonemap(vec3 x) { float a = 0.15; float b = 0.50; float c = 0.10; float d = 0.20; float e = 0.02; float f = 0.30; return ((x*(a*x+c*b)+d*e)/(x*(a*x+b)+d*f))-e/f; } void main() { vec2 uv = gl_FragCoord.xy / u_resolution; vec4 sampledInput = texture(t_input, uv); vec4 hdr = vec4(sampledInput.rgb * exposure, sampledInput.a); hdr.rgb = Uncharted2Tonemap(hdr.rgb) / Uncharted2Tonemap(whitepoint.rgb); out_color0.rgba = hdr; }