automated snapshot
This commit is contained in:
21
shaders/saturation.fs
Normal file
21
shaders/saturation.fs
Normal file
@@ -0,0 +1,21 @@
|
||||
#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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user