Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vibrance shader glsl #132

Closed
geextahslex opened this issue Apr 13, 2024 · 1 comment
Closed

vibrance shader glsl #132

geextahslex opened this issue Apr 13, 2024 · 1 comment

Comments

@geextahslex
Copy link

geextahslex commented Apr 13, 2024

Hi I use this shader to desaturate dark colors in mpv. I want to make something similar but with vibrance instead of saturation. Can you help me out with that?
Thank you :)

//!PARAM Strength
//!DESC Desat Strength
//!TYPE float
//!MINIMUM 0
//!MAXIMUM 1
1

//!HOOK MAIN
//!BIND HOOKED
//!DESC Desaturation smooth


#define Thresh 35/255.
#define w 10/255.
#define CoefLuma vec4(0.2126, 0.7152, 0.0722, 0) //sRGB, HDTV

/* simple threshold with mpv glsl
Strength*desaturation [0 to1.0], 0: full color, 1: grayscale.
*/

vec4 hook()  {
   vec4 c0 = HOOKED_texOff(0);
   float desaturation = smoothstep(Thresh + w, Thresh - w, dot(c0, CoefLuma));
   // return vec4(desaturation, 1);
   c0.rgb = mix(c0.rgb, vec3(dot(c0, CoefLuma)), Strength*desaturation);

   return c0;
}

@patriciogonzalezvivo
Copy link
Owner

@geextahslex please use the issues section for making questions about LYGIA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants