3 uniform sampler1D curve;
13 vec4 sample = texture(source, texcoord);
14 float maxc = max(sample.r, max(sample.g, sample.b));
17 vec3 saturated = sample.rgb/maxc;
20 sample.rgb = mix(vec3(1.0), saturated, 1.0/pow(brightness, maxc-1.0-peak));
24 float x = (1.0+peak-maxc)/(2.0*peak);
25 sample.rgb = saturated.rgb*(1.0-peak+(1.0-x*x)*peak);
28 frag_color = vec4(texture(curve, sample.r).r, texture(curve, sample.g).r, texture(curve, sample.b).r, sample.a);