Friday, November 9, 2007

Mapping the Rainbow

In Physics 101, we learn that color is one-dimensional . A color can be described by just one number, the frequency of the light. When light passes through a prism, or a raindrop, the angle of refraction depends on the frequency, which gives us the rainbow.

In Programming 101, we learn that color is three-dimensional. A color requires three numbers for its description, a red value, a green value and a blue value. You can think of colors as being graphed with x, y and z co-ordinates. LCD screens, web pages and digital cameras are all based on this three-dimensional model.

Alternatively, in Biology 101, we learn that the human eye has three kinds of color receptors, corresponding more or less to red, green and blue. We can see that the computer model is based on the biological model, not the physical model.

So how do we map a one-dimensional spectrum to a three-dimensional grid? The picture above is my first attempt. Not very rainbowish, is it? (I'm trying to find a mathematical formula that I can program to generate a rainbow graphic.)

The mismatch between models leads to some weird anomalies. For example, there really is such a thing as yellow light, but the yellow on your computer screen is a mixture of red and green. Your computer screen doesn't have any yellow in it.

On the other hand, there is no such thing as purple light. We think of purple as being half way between red and blue, but red and blue are at opposite ends of the spectrum, so there is no half way between. There really is a violet, on the far side of blue, but violet is not the same as purple. In physics, that is. In computers, both purple and violet are made by mixing red and blue.

It's an interesting mess. I'm trying to see it as more of an opportunity than a problem. I'll go with the three-dimensional model, because that's what my computer tools use. If I can't generate realistic rainbows, I'll generate alien rainbows, with the colors in the wrong order.

4 comments:

TTB said...

>>If I can't generate realistic rainbows, I'll generate alien rainbows, with the colors in the wrong order.<<

Not to get all literal on you, but wouldn't rainbows be the same in Bolivia as Hawaii? And Saturn? And even at the Mote in God's Eye?

Anonymous said...

Physics is physics, but:

1. Aliens might have different color receptors in their eyes.

2. An alien sun might have a different spectrum.

3. Alien rain, or whatever condenses out of their sky, might have a different refractive index than water.

Anonymous said...

With sound there are two numbers, frequency and loudness. A 2000 Hz at 139 DB will stop an elephant in its tracks. Doesn't color have a second number, or possible a second number that hasn't been mapped adequately and would that number help with creating a rainbow? The shades and tones of a primary number? so maybe we see in a more integrated manner than we hear.

Also, Since biological patterns are built on chemical and physical patterns, it would be possible to actually match alien species with alien environments. Nes Pa?
CET

Anonymous said...

1. Loudness is a dimension of plaids, not colors.

2. Intensity and frequency (color) are dimensions of light. Intensity corresponds to the brightness control on your computer screen. But this just gives us 2 dimensions vs. 4 dimensions instead of 1 dimension vs. 3 dimensions. Adding a dimension doesn't solve the mismatch.

3. It would be possible for human eyes to match human environments, but they don't.