3 uniform sampler1D curve;
7 vec3 brightness_response;
13 vec4 incoming = texture(source, texcoord);
14 float maxc = max(incoming.r, max(incoming.g, incoming.b));
17 vec3 saturated = incoming.rgb/maxc;
18 maxc = pow(maxc*exposure+brightness_response.y, brightness_response.x)-brightness_response.z;
19 float c = min(maxc, 1.0);
20 float minc = min(saturated.r, min(saturated.g, saturated.b));
21 incoming.rgb = mix(saturated, vec3(1.0), min((maxc-c)/(1.0-minc), 1.0))*c;
23 frag_color = vec4(texture(curve, incoming.r).r, texture(curve, incoming.g).r, texture(curve, incoming.b).r, incoming.a);