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)