I need a way to saturate (not desaturate) colors in a GLSL shader. There's code all over the place for desaturating an image. Example:
vec3 desaturate(vec3 color, float amount)
{
vec3 gray = vec3(dot(vec3(0.2126,0.7152,0.0722), color));
return vec3(mix(color, gray, amount));
}
Many suggest converting RGB to HSV space before increasing saturation. However, I don't need to change hue, only saturation. If I pass negative values to the above function, it indeed appears to saturate the image. Is there anything technically wrong about doing it this way? Am I trying to take a dangerous shortcut here?