[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Color spaces etc, was Re: [pygame] "Making Games with Python & Pygame" free book



I started writing something, but then everyone else did too:

1) Color theory is hard because what brains do is not reducible to simple equations, even on the best of days. No, really. There are zillions of optical illusions that prove this, where, for instance, a blue square looks pink because of the surrounding stuff. Feel free to ask google to show you these. They are fun.

2) Making a mathematical approach to color mapping is impossible, because, very simply: the space of perceptible color is not polygonal. Any system using N primary colors, by definition, produces a polygonal color gamut (range of colors that can be produced). So you end up not being able to render all visible colors. (OK, smart guy, you CAN render more than the perceptible color space, as an alternative, and unless you have lots of bits per pixel, leaving gaps in the gamut.)

3) Wikipedia has lots of pages about color rendering, spaces, etc. Unfortunately, all of them have a lot of hard math on them, so I don't blame you for not reading them. However, if you do, you will learn stuff. Unfortunately, when you are asked to explain it to non-geek friends, you end up repeating points 1 and 2 above.

4) Everything else on color amounts to this:
a) Over the years, people have figured out a lot about color, but there are still some completely baffling things. (See point 1)
b) Many different approaches to color have been used. They are all hacks to reproduce a pretty good set of colors while at the same time being practical to implement. However, point 2 above will still apply: you simply cannot render anything approaching the human-perceptible color space with a small number of primaries or axes.

For instance, the infamous NTSC color space turns out to be a remarkably well designed hack, because they started with the mandate of being compatible with black and white TV, and that meant they had to transmit a black and white TV signal and then squeeze in color info where it would not screw old sets up. So their color space is defined by three axes: Brightness (Y), Red/Magenta (I), and Green/Purple (Q). They picked these three because Y is the same as black and white, and because the human eye is more sensitive to red-magenta errors than green-purple errors. So as a result, most of the bandwidth encodes Y, some is used for I, and only a little for Q. So if you see NTSC color bars on a monitor, that is why the edge between the green and purple bar is so blurry. For real!

http://en.wikipedia.org/wiki/YIQ 

5) Anyway, all of this is irrelevant since scientists discovered a fourth primary color, as documented here: http://www.negativland.com/squant/