Colorblind simulation #6356
onpon4
started this conversation in
Enhancement ideas (and their technical discussions)
Replies: 1 comment 2 replies
-
As a sidenote, the browser already comes with accessibility checking tools to see how the page looks like through a few vision deficiencies: chrome_Ny192RDzhZ.mp4 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Something I've found useful in a C project is colorblind simulation with a pretty simple GLSL shader. I'd be really keen to have this in GDevelop, and while I don't feel really capable of doing it right now (having only just the other day started learning to be a user of GDevelop), I wanna put this out there in case anyone else wants to take what I've got, because in principle the work is very very simple, but I'll need to get comfortable working with GDevelop before I dive this deep into it. 😅
I've done a little looking into things and I think the best way to do this would be to make an "effect" with an extension, and that it would be best applied as a layer effect, if I'm understanding things correctly.
This is a GLSL shader I put together for a particular game (originally based on someone else's work which was copied from a template somewhere, but all I ended up preserving was the broad structure and the wording of some comments):
I spent a decent amount of time trying to make sure this would be as accurate as possible. It's likely imperfect, and anomalous trichromacy is in particular not something that we really have a verified accurate simulation method for (most just take a weighted average between the unmodified image and dichromacy simulation), but it should hopefully be accurate enough to do its job, which is to aid in deciding what colors to select for colorblind accessibility. The only simulation I couldn't find definitive verification for was the method for achromatopsia (rod monochromacy), but achromatopsia is more complicated than any simulator would suggest anyhow, so I'm guessing its accuracy is Good Enough™.
Particular changes that need to be made to the shader to make it work in GDevelop are of course editing the uniform/in/out to match whatever an extension or whatever would want to use, but also, the RGB values need to be in linear RGB; the game this was made for has all color stored as a linear value, so it didn't need a conversion, but I assume GDevelop's RGB values are stored in the more standard sRGB color space or similar. https://ixora.io/projects/colorblindness/color-blindness-simulation-research/ (the main source I used writing this shader) explains how to do the necessary conversion from and to sRGB. The conversion is necessary for the colorblindness simulation to be accurate.
Another change that would be beneficial is to use the source the anomalous trichromacy simulations are based on to calculate the simulation changes based on a "severity" parameter (with a value between 0 and 1). The numbers used in this GLSL code are based on a chart on https://www.inf.ufrgs.br/~oliveira/pubs_files/CVD_Simulation/CVD_Simulation.html which shows a table of matrices for 10 different increments of severity, but as it mentions, more granularity is possible; it'd just take a lil more math. The simulation used for anomalous trichromacy in theory is supposed to simulate dichromacy with a severity of 1, but dichromats have reported that older dichromacy simulations are more accurate, so I ended up sticking with the different approach for simulating dichromacy. See https://daltonlens.org/opensource-cvd-simulation/ for a detailed overview.
If anyone would like to take a stab at the effort of getting this to work on GDevelop, I'm ok with making the shader available under whatever license you like (CC0 if you need a specific license). Otherwise, I'm sure I'll get to doing it myself eventually after I'm more familiar with GDevelop as a whole.
Beta Was this translation helpful? Give feedback.
All reactions