mirror of
https://github.com/sahinakkaya/dotfiles.git
synced 2024-11-14 04:59:36 +01:00
41 lines
1.2 KiB
GLSL
41 lines
1.2 KiB
GLSL
|
// vibrance for hyprland
|
||
|
|
||
|
precision mediump float;
|
||
|
varying vec2 v_texcoord;
|
||
|
uniform sampler2D tex;
|
||
|
|
||
|
// see https://github.com/CeeJayDK/SweetFX/blob/a792aee788c6203385a858ebdea82a77f81c67f0/Shaders/Vibrance.fx#L20-L30
|
||
|
const vec3 VIB_RGB_BALANCE = vec3(1.0, 1.0, 1.0);
|
||
|
const float VIB_VIBRANCE = 0.15;
|
||
|
|
||
|
|
||
|
const vec3 VIB_coeffVibrance = VIB_RGB_BALANCE * -VIB_VIBRANCE;
|
||
|
|
||
|
void main() {
|
||
|
|
||
|
vec4 pixColor = texture2D(tex, v_texcoord);
|
||
|
|
||
|
// RGB
|
||
|
vec3 color = vec3(pixColor[0], pixColor[1], pixColor[2]);
|
||
|
|
||
|
|
||
|
// vec3 VIB_coefLuma = vec3(0.333333, 0.333334, 0.333333); // was for `if VIB_LUMA == 1`
|
||
|
vec3 VIB_coefLuma = vec3(0.212656, 0.715158, 0.072186); // try both and see which one looks nicer.
|
||
|
|
||
|
float luma = dot(VIB_coefLuma, color);
|
||
|
|
||
|
float max_color = max(color[0], max(color[1], color[2]));
|
||
|
float min_color = min(color[0], min(color[1], color[2]));
|
||
|
|
||
|
float color_saturation = max_color - min_color;
|
||
|
|
||
|
vec3 p_col = vec3(vec3(vec3(vec3(sign(VIB_coeffVibrance) * color_saturation) - 1.0) * VIB_coeffVibrance) + 1.0);
|
||
|
|
||
|
pixColor[0] = mix(luma, color[0], p_col[0]);
|
||
|
pixColor[1] = mix(luma, color[1], p_col[1]);
|
||
|
pixColor[2] = mix(luma, color[2], p_col[2]);
|
||
|
|
||
|
gl_FragColor = pixColor;
|
||
|
}
|
||
|
|