第 7 课:Contrast
我的解
uniform vec2 iResolution;
uniform sampler2D iChannel0;
vec3 RelativeLuminance(vec4 tex){
return vec3(tex.r * 0.2126 + tex.g * 0.7152 + tex.b * 0.0722);
}
void main() {
// Normalized pixel coordinates (from 0 to 1)
vec2 uv = gl_FragCoord.xy / iResolution.xy;
vec4 tex = texture(iChannel0, uv);
vec3 luminance = RelativeLuminance(tex);
vec3 saturated = mix(luminance,tex.rgb,2.0);
gl_FragColor = vec4(saturated,1.0);
}