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

Have in editor options to simulate common forms of color vision deficiency (color blindness) #21304

Closed
Two-Tone opened this issue Aug 23, 2018 · 17 comments

Comments

@Two-Tone
Copy link

Two-Tone commented Aug 23, 2018

A decent number of people suffer from being colorblind and as a result a lot of games are considerably harder or even impossible to play unless the devs specifically go out of their way to include colorblind modes.

My suggestion is to have toggles in the editor that lets the developer see what their game looks like if they had deuteranomaly, protanomaly, or tritanomly. It'll help the devs who want to create color blind modes by letting them see what those users would see.

@Two-Tone
Copy link
Author

Two-Tone commented Aug 23, 2018

I have no idea how this just submitted while I was still typing the freaking title.

Okay, fixed. I think.

@Two-Tone Two-Tone reopened this Aug 23, 2018
@Two-Tone Two-Tone changed the title Have in editor options to simulate common forms of color vision deficiency Have in editor options to simulate common forms of color vision deficiency (color blindness) Aug 23, 2018
@akien-mga
Copy link
Member

Related to #15944.

@MattUV
Copy link
Contributor

MattUV commented Aug 23, 2018

I think someone just watched the last GMTK video ;)

I don't know if it is necessary as part of the engine, but it may be a great plugin for the library!
Probably a rectangle with preconfigured shaders?

@Two-Tone
Copy link
Author

The shaders to simulate these isn't at all complex (making the burden of maintaining them very small), but I definitely think it should be included by default to encourage devs to consider colorblind users and how their game looks to them.

And yes, Mark Brown was definitely the inspiration!

@MattUV
Copy link
Contributor

MattUV commented Aug 23, 2018

I remember Juan saying he didn't want to bloat the editor. But I do agree with you, it is a major concern. Would it be considered as bloating? I don't know...

Anyway, either a plugin or an integrated option, here is the algorithm used by many tools online that I have encountered. 6 years ago I might have been able to understand everything but I haven't practiced mathematics since 2012 ;)
I leave the link here if someone wants to tackle with this issue: http://vision.psychol.cam.ac.uk/jdmollon/papers/colourmaps.pdf

@MattUV
Copy link
Contributor

MattUV commented Aug 23, 2018

Alright, I have studied more deeply the algorithms (it is not that hard actually).
The link (a.) (links below) I have provided in my earlier post is correct, but only treats Protanopia and Deuteranopia. I would have to make more calculus for the Tritanopia. It is not impossible, but tricky. As mentioned here (b.), some algorithms that can be found online are wrong due to the misuse of initial hypothesis from (a.). I will not explain everything here, because (b.) does it better than me.

So, I think it is good to use the algorithm from (b.)
I will summarize it here, but I suggest you visit the link (b.), which is really interesting.

For each pixel of color [R, G, B] (R, G and B in the interval [0,1]), we want to calculate the colorblind equivalent depending on the pathology :

  • Protanopia [Rp, Gp, Bp]
  • Deuteranopia [Rd, Gd, Bd]
  • Tritanopia [Rt, Gt, Bt]
    methode colorblindness
  1. Remove the gamma correction to get [Rc,Gc,Bc], where:
  • Xc = X/12.92 if X<= 0.04045
  • Xc = ((X+0.055)/1.055)^2.4 if X > 0.04045
  1. Calculate the filtered color depending on the color blindness type :
  • Protanopia : [Rpc,Gpc,Bpc] = T^-1 * Sp * T * [Rc,Gc,Bc]
  • Deuteranopia : [Rdc,Gdc,Bdc] = T^-1 * Sd * T * [Rc,Gc,Bc]
  • Tritanopia : [Rtc,Gtc,Btc] = T^-1 * St * T * [Rc,Gc,Bc]
    • Where T, T^-1, Sp, Sd and St are 3x3 matrices :
      matrices colorblindess
  1. Reapply the gamma correction to get the final value [Rp,Gp,Bp] :
  • Xp = 12.92 * Xpc if Xpc<= 0.0031308
  • Xp = 1.055*Xpc^0.41666 - 0.055 if Xpc > 0.0031308

Sources:
(a.) http://vision.psychol.cam.ac.uk/jdmollon/papers/colourmaps.pdf
(b.) https://ixora.io/projects/colorblindness/color-blindness-simulation-research/

@ninao-xyz
Copy link

Just leaving a note here, that there is the scribus.net opensource program that implements it, maybe ppl can take a look how they implement the shader.
Anyways, if possible, I wold like to have this godot.

color_blind

@vnen
Copy link
Member

vnen commented Aug 23, 2018

I guess @paulloz was inspired by the same source: https://github.com/paulloz/godot-colorblindness

@MattUV
Copy link
Contributor

MattUV commented Aug 23, 2018

Ha ha! This is going so fast!
@paulloz , I think you forgot to remove the gamma correction. You are working with the RGB profile instead of the sRGB profile.

@paulloz
Copy link
Member

paulloz commented Aug 24, 2018

Haha yeah, I wanted to make something like this for a long time as I often struggle with some color choices in games I play. Mark's video was some kind of a reminder: now that I somehow know how to write a shader, I could finally do that.
I looked for other assets in the library doing this kind of thing and didn't find any. But I didn't think of looking at issues down here. I'm glad other persons think this is important.

I'm currently implementing achromatopsia and will probably add some kind of strength parameter to be able to simulate more common types of colorblindness (e.g. deuteranomaly).

@MattUV IINW I approximate linear space here. I'll have a look at your calculation and see if there's any major difference between the two. Thanks!

Cheers all ❤️.

Edit (an hour later): @MattUV indeed your formula for gamma correction handles dark tones a little better. Beware though, one of your values for RGB -> sRGB is off by a factor of ten :V

@NuclearCookie
Copy link

I see you're hardcoding the gamme corrections. Is there currently no way to change the gamma value in the engine?
Looking towards the future, I think it would be best to change the gamma computation here so that it works with different gammas.

@Calinou
Copy link
Member

Calinou commented Aug 24, 2018

Is there currently no way to change the gamma value in the engine?

As far as I know, no. It's possible to perform some adjustments and color correction in 3D using a WorldEnvironment node, but it only affects 3D rendering.

@eon-s
Copy link
Contributor

eon-s commented Aug 24, 2018

@Calinou environment in Canvas mode makes effects to affect 2D too (including tonemap, glow, color adjustment).

@Two-Tone
Copy link
Author

I think that the issue of contributing bloat is offset by how small colorblind shaders can be as well as the benefit of making developing for the disabled easier in Godot.

Even if we ignore all the current issues with the asset library, having this as a plugin greatly diminishes the usefulness of it simply because it's something most people don't consider. Having it in editor and easily discoverable will make it much, much more likely that devs will use the tool and develop for the colorblind.

@paulloz
Copy link
Member

paulloz commented Aug 25, 2018

Trust me, it's (sadly) not something most people will consider whether this is part of the engine or not. It's often not considered even if I'm right in front of the developers in a convention saying that their colour choices aren't right.
This issue will only be dealt with through educational content, whether tools are available within the engine or as external resources.

@KlemensStrasser
Copy link

@paulloz - I wouldn't say so. @Two-Tone is right that having it in the engine increases discoverability and thus, raises awareness that this issue even exists. I would argue that many game developers do not even think about something like color blindness. Having an option for a color blindness might be enough to get somebody to look into it. So I would strongly suggest putting it in the engine, even if its just to have feature parity with the Unreal Engine.

@Two-Tone
Copy link
Author

Ported this over to godotengine/godot-proposals#473, closing here.

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

No branches or pull requests

10 participants