Interactive Illustrations of Color Perception

Interactive Illustrations of Color Perception

For the color theory portion of the introductory computer graphics course at Brown University (CS123), Professor John Hughes sketched out some ideas for interactive illustrations. These were programmed in Flesh by Jeff Beall, and later ported to C++ and GP (also by Jeff). They have recently been ported to Java by Adam Doppelt. The illustrations will be used during the lectures in the course, and they will also be available to students outside class; the following informal text by Professor Hughes is meant to help guide the viewer in understanding the illustrations. To view the interactive illustrations themselves, you must be running a Java compatible browser, such as Netscape Navigator.

Colored light arrives at the eye, and somehow gets to the brain, and extensive research shows that the brain perceives the color of the light in a 3-dimensional way -- that is to say, there are three independent components to the brain's perception of color. This matches physiological evidence that there are three types of color-receptor cells in the eye.

The light that arrives at the eye, however, is a much more complex phenomenon: it consists of photons with varying amounts of energy, which correspond to varying wavelengths (or frequencies) of light. In most ordinary light, there is a mix of various frequencies, and at a macroscopic scale, one can indicate this mix of photons by drawing a graph of intensity versus frequency. If light is generated very carefully, it sometimes consists of photons that all have the same energy, so that the light is of a single frequency. We'll refer to such light as "monospectral." Laser light is the standard example of a monospectral light.

How does incoming light affect the three types of cells? Let's look at one cell-type at a time, such as the "green" cells (ones that are sensitive to light primarily in the 520 nm wavelength). First of all, at a very coarse level, the response is linear: if the green cells are stimulated by one light and produce one response -- some amount of signal to the brain -- and if in response to a second light and produce another, then when they are stimulated by both lights at once, they produce the sum of the two responses.

Second, the green cells will respond to monospectral light of many different wavelengths. If we take a variable-frequency light of constant intensity, and measure how much "response" we get from a typical "green cell" in response to this light, we can plot this response against frequency, and call it "the frequency response" of the green cells.

If we've done this, and we then send the eye a mix of light rather than a pure monospectral light, we can compute the total response by summing up the product of the "incoming light intensity" and the "frequency response" at each frequency. In equations, this is

or, assuming that we've actually determined the frequency response at every single frequency, we can write this as an integral:

To compute this integral, we can first compute the product of the two functions, and then compute the area under this product function. Illustration 1 shows this: the user can draw a distribution of input intensity as a function of wavelength; the frequency response of the "green cells" is indicated in the middle, and the product of the two is shown at the bottom. The user draws in this illustration, and all the others, by holding down the left mouse button within one of the red boxes and moving the mouse -- try it and the interaction should rapidly become obvious. The mouse may go outside the box during a single click-and-drag sequence, but it must start inside or nothing will happen. The area under this product curve is shown on the bar indicator at the right. In this illustration, the "frequency response" is not the real frequency response of the green cells, but rather a graph whose shape is somewhat similar, but the method of computing the total response does not depend on the particular shape of the response curve.

One thing to try here is drawing "input" that's more or less monospectral -- draw a "bar" of light all near one frequency, and note how the total response depends on where you draw the bar -- the total response is largest when the bar is near the "hump" of the response curve.

Multiple types of color cells

There are cells other than the green cells in the eye -- there are two other kinds, one more responsive to lower frequencies, and one more responsive to higher frequencies. Naturally, this leads to three different "total responses" to any given input frequency distribution. The second illustration shows this: the reader can draw any input distribution, the three response curves for the three cell types are shown in the middle, the products of these with the input are shown at the bottom, and the upper right shows the three "total responses." Once again, try to see what the total response to "nearly monospectral" lumps of light looks like as you vary the central frequency of the nearly monospectral light.

Different lights that look the same

The way we perceive light depends on the three "total responses" produced by the light that enters the eye. It's a surprising fact that different incoming light distributions can generate the same three total responses. The third illustration lets you examine this. In particular, you can draw a nearly uniform frequency distribution on the left side, generating a mix of equal parts of red, green, and blue "total responses." But you can also draw, on the right, a more sawtooth pattern which produces the same total responses. Such pairs of light distributions are called "metamers," or "metameric lights." Try to play with the illustration to see how different two incoming lights can be and still produce the same response in the eye.

What about reflection?

Suppose that we shine a light onto a surface. The surface may well be good at reflecting certain frequencies and good at absorbing others. (Indeed, this reflectivity may vary with the angle at which light arrives and departs from the surface, but for a first approximation we'll assume that a single "reflectivity number" at each frequency suffices to characterize the surface). We'll plot this reflectance against frequency, and we can then say when a given distribution of light is shined on the surface that the light that comes off the surface will be the product of the reflectance function and the incoming light distribution. The fourth illustration shows this, and allows the reader to play with examples that are hard to get ahold of in the real world -- materials that reflect more or less a single frequency of light, illuminated by various sorts of light. Try seeing what happens when high-frequency light arrives at a surface that reflects only low-frequency light -- a "very blue light" shining on a "very pure red" surface.

Next Page

Questions or feedback on these illustrations should be sent to John F. Hughes.
Questions on the Java source should be sent to Adam Doppelt.