I have this vibrance shader, It has an srgb threshold which can be adjusted. But the shader affects all saturation levels/%. I would like to leave colors that have a saturation under 80% unaffected, and target the above 90% saturation pixels, with a smooth transition between them (80-90%). So the first condition is the srgb threshold and the 2nd condition would be the pixel saturation. From my understanding this shader already checks saturation levels but I don’t know how this works. Any help would be appreciated 🙂
side note: I don’t understand shaders, I just want to make this one adjustment.
//!PARAM vibr
//!DESC Saturates/deSaturates
//!TYPE float
//!MINIMUM -1
-0.3
//!HOOK MAIN
//!BIND HOOKED
//!DESC Vibrance
#define CoefLuma vec4(0.2126, 0.7152, 0.0722, 0) //sRGB, HDTV
float Thresh = 45.0/255.0;
float w = 10.0/255.0;
vec4 hook() {
vec4 c0 = HOOKED_texOff(0);
float lum = (c0.r + c0.g + c0.b)/3.0;
float colorSat = max(max(c0.r, c0.g), c0.b) -min(min(c0.r, c0.g), c0.b); // >=0, 5 arithmetic
vec3 sat = mix(vec3(dot(c0, CoefLuma)), c0.rgb, 1+vibr -colorSat*abs(vibr));
float delta = smoothstep( Thresh-w, Thresh+w, lum);
c0.rgb = mix( sat, c0.rgb, delta);
return c0;
}
I didn’t try anything, as I don’t understand shaders code. I tried to get some help from people who know how all of this works.
geextah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.