22 lines
441 B
GLSL
22 lines
441 B
GLSL
#version 330
|
|
|
|
in vec2 fragTexCoord;
|
|
in vec4 fragColor;
|
|
|
|
uniform sampler2D texture0;
|
|
uniform float uSat; // 0 = grayscale, 1 = original, >1 = boosted
|
|
|
|
out vec4 finalColor;
|
|
|
|
void main() {
|
|
vec4 c = texture(texture0, fragTexCoord) * fragColor;
|
|
|
|
// luminance (perceptual-ish)
|
|
float l = dot(c.rgb, vec3(0.2126, 0.7152, 0.0722));
|
|
vec3 gray = vec3(l);
|
|
|
|
c.rgb = mix(gray, c.rgb, uSat);
|
|
finalColor = c; // preserves alpha
|
|
}
|
|
|