Noble Master Games
Noble Master Games



Dev. Blog

Noble Master Developer's Blog

October 26, 2013

OpenGL Shader to Correct and Simulate Color Blindness (Experimental)

Filed under: Development — noblemaster @ 18:11

I was playing around with real-time color correction for colorblind players. I tried to focus on the following three types of color vision deficiencies (simplified explanation):

  • Protanopia/Protanomaly: complete/partly absence of red retinal receptors; in about 2% of men (rare for women).
  • Deuteranopia/Deuteranomaly: complete/partly absence of green retinal receptors; in about 7% of men (rare for women).
  • Tritanopia/Tritanomaly: complete/partly absence of blue retinal receptors; in less than 1% of men/women.

For a more detailed explanation, please refer to Wikipedia. The code I used is based on Tyler Howard’s thesis on a real-time color correction for colorblind users. I adapted the algorithm for a OpenGL ES 2.0 shading algorithm. I have also contacted Tyler Howard for test results but haven’t received a reply back. Also it appears that the color correction used the same method for Protanoopia and Deuteranopia which seems odd. In any case the source code for the OpenGL shader is available below.

I integrated the shading code into Demise of Nations (game still under development). Original uncorrected image:

Color Correction (Original Uncorrected Image)

Color Correction (Original Uncorrected Image)

Simulation and Correction for Protanopia:

Color Correction - Protanopia

Color Correction – Protanopia

Simulation and Correction for Deuteranopia:

Color Correction - Deuteranopia

Color Correction – Deuteranopia

Simulation and Correction for Tritanopia:

Color Correction - Tritanopia

Color Correction – Tritanopia

I generally feel the results with the color correcting code are minimal at best. It appears some of the lightness is corrected when applying the color correction filter but otherwise the benefits are marginal at best. A better option is designing for colorblind users beforehand using different shapes in addition to colors. I would love to hear back from colorblind users, so please comment, thanks.

Another great site regarding color correcting code is I haven’t tried to integrate the sample code provided but it looks very promising.

Download: OpenGL Code for Color Blindness Correction/Simulation (Java)


  1. I am interested to understand what you think is wrong with the first image that needs correcting?

    I am red/green colour deficient, but I have no problem with anything on your first image. All the fixed images just look wrong too me. The red in the Tritanopia example looks better than all the other images, but it’s actually better in the simulation not the correction. The red however in your first image is better than all the others.

    It appears that all you have done is changed the colour of the banners and the characters. Except for Tritanopia example where you have removed colour from the rest of the game.

    So, what are you trying to fix?

    Comment by Chris Wild — October 27, 2013 @ 22:03

  2. That’s a good question. I am trying to make the colors more clearly distinguishable so things are “easier” to see. Not sure if it actually make sense for this type of game? Not so sure how well (if at all) this works?

    Comment by noblemaster — October 28, 2013 @ 09:15

  3. Ok, try coming at this from another angle.

    The main problem with colourblindness is the separation of colours. And this is where games fall foul.
    So in your example of using Red banners, this only becomes a problem if you also use green banners, and then this is only usually a problem if the green is darker. The red, dark green, and brown will start to look the same, especially when close together. The same will happen when you use a light green and yellow for example.

    Now, in your images, there is nothing in them that is causing this problem.

    So, make the middle centurion and his banner a green colour in the range 0,90,0 and he becomes problematic. Make him brown in the same range 90,90,0 and it is also a problem.

    On their own, those colours would be alright, not if you ask me to pick out the green or brown player. But put them on the screen at the same time, and I would be screwed!

    Comment by Chris Wild — October 28, 2013 @ 10:47

  4. Got it! Actually, I am not just using colored banners. All the banners have their nations’ flag so I hope it shouldn’t really pose a problem. Also, border points on the map have different shapes if two nations are neutral/at war/etc. to indicate the type of diplomatic relation. The border points are colored as well but adding the shape should help make things clear.

    If you are interested, I am planning for the first alpha-test end of October, so if you want to participate I would definitely appreciate it! That way you can see if the shaders have some actual benefit.

    Comment by noblemaster — October 28, 2013 @ 16:39

  5. I’ll be happy to take a look…

    Comment by Chris Wild — October 29, 2013 @ 19:43

  6. Great – I’ll send out the testing details via email. Please email met at contact at and I’ll add me to my list. Thanks!

    EDIT: actually, looks like I have your email you used for this blog. Let me know if it’s OK with you and I’ll email you there when it’s ready?

    Comment by noblemaster — October 30, 2013 @ 14:09

Sorry, the comment form is closed at this time.