-
|
This is what I have so far, I dont know any glsl pretty much at all. I also don't fully understand what im doing here, this has been cobbled together from a bunch of different sources. It does not look right at all. Completely blown out and some of the colors such as purple cant be seen on a white background. I have just been messing with the values for the last little bit but nothing looks right. If someone could help explain why that is happening that'd be great 😅 |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
|
I also know next to nothing about glsl 😅. Does this work well for you? (You may have to change the I'd be interested in adding some shaders (+ updating the readme) that assist those with color blindness so that no one has to reinvent the wheel. |
Beta Was this translation helpful? Give feedback.
-
|
Got it working thanks to the resource you linked @loqusion ! Shader |
Beta Was this translation helpful? Give feedback.
-
|
@lividhen Do you think it would be useful for hyprshade to provide configurable intensity, so that people don't have to modify the shader by hand? There could be a field in [[shades]]
name = "color-filter"
[shades.config]
type = "protanopia" # "protanopia", "deuteranopia", "tritanopia"
intensity = 1.0 # 0.0 - 1.0(I also added configurable On a separate note, do you have any suggestions for what to name the shader? |
Beta Was this translation helpful? Give feedback.
-
|
Hei, really nice shader. I modified it so it in corporates the intensity correctly. Since the 100% was a bit much for me :) //Color blind shader for hyprland.
//Based off the shader : https://godotshaders.com/shader/colorblindness-correction-shader/.
precision highp float;
varying vec2 v_texcoord;
uniform sampler2D tex;
//Intensity of filter (1.0 - 0.0)
const float intensity = 1.0;
// Color correction mode
// 0 - Protanopia
// 1 - Deutranopia
// 2 - Tritanopia
const int mode = 1;
void main()
{
vec4 pixColor = texture2D(tex, v_texcoord);
float L = (17.8824 * pixColor.r) + (43.5161 * pixColor.g) + (4.11935 * pixColor.b);
float M = (3.45565 * pixColor.r) + (27.1554 * pixColor.g) + (3.86714 * pixColor.b);
float S = (0.0299566 * pixColor.r) + (0.184309 * pixColor.g) + (1.46709 * pixColor.b);
float l, m, s;
if (mode == 0) //Protanopia
{
l = 0.0 * L + 2.02344 * M + -2.52581 * S;
m = 0.0 * L + 1.0 * M + 0.0 * S;
s = 0.0 * L + 0.0 * M + 1.0 * S;
}
if (mode == 1) //Deuteranopia
{
l = 1.0 * L + 0.0 * M + 0.0 * S;
m = 0.494207 * L + 0.0 * M + 1.24827 * S;
s = 0.0 * L + 0.0 * M + 1.0 * S;
}
if (mode == 2) //Tritanopia
{
l = 1.0 * L + 0.0 * M + 0.0 * S;
m = 0.0 * L + 1.0 * M + 0.0 * S;
s = -0.395913 * L + 0.801109 * M + 0.0 * S;
}
vec4 error;
error.r = (0.0809444479 * l) + (-0.130504409 * m) + (0.116721066 * s);
error.g = (-0.0102485335 * l) + (0.0540193266 * m) + (-0.113614708 * s);
error.b = (-0.000365296938 * l) + (-0.00412161469 * m) + (0.693511405 * s);
error.a = 1.0;
vec4 diff = pixColor - error;
vec4 correction;
correction.r = 0.0;
correction.g = (diff.r * 0.7) + (diff.g * 1.0);
correction.b = (diff.r * 0.7) + (diff.b * 1.0);
correction = pixColor + (correction * intensity);
correction.a = pixColor.a;
gl_FragColor = correction;
} |
Beta Was this translation helpful? Give feedback.
Got it working thanks to the resource you linked @loqusion !
Here is what I ended up with. If I could get feedback from people with different types or more intense red green color blindness that'd be great as mine is only very slight.
Shader