Keenan's Blog

Computer Graphics From Scratch


1-2 Color Models

Color theory is fascinating but there is too much of it to cover. To put it briefly, every color imaginable can be described as being different combinations of visible wavelengths and frequencies. White is the combination of all colors and black is no color. All colors can be created from combining just three colors called primary colors.

Subtractive Color Model

Subtractive color model is what you get when you use the three primary colors: Red, Yellow, and Blue to create other colors. Red and Blue make Purple, Yellow and Red make Orange, Yellow and Blue make Green, and the combination of all 3 makes a dark color.


Figure 1-3: Subtractive primary colors and their combinations

Everything that has color absorbs and reflects light differently. White light has every wavelength of colors. When it hits an object the object absorbs some of the light and reflects others. If you have a white piece of paper and a red marker and you color some of the white paper you are adding a layer of material that reflects and absorbs light differently so the color we see looks like red on the paper. What the red marker is doing is subtracting wavelengths from white light to get the color red.

We start out with every color and subtract some amount to get another color.

However this model isn't quite right. The real primary colors of the subtractive model arent red, yellow, and blue its actually Cyan, Magenta, and Yellow. Mixing all three colors does not quite get us black so it is represented by a K, it is not represented by a B becuase that is used by blue. So the true color model is CMYK


Figure 1-4: The Four Subtractive primary colors used by printers

Additive Color Model

Computer screens are not like paper. Paper doesn't emit ligth it just reflects it. Screens, however, are black and emit light on their own. So with paper we start with all colors and subtract, with screens we start with no colors and add.

Different Primary colors are used for this method. Most colors can be created by adding amounts of red, green and blue to a black surface. This is called the RGB Color Model which is considered an Additive Color Model. Adding up all the primary colors gives us white. Subtracting all of them gives us black.


Figure 1-5: The Four additive primary colors represented by lights

Forget the Details

Now that we've gotten to the Additive color model you can shelve the other model in your brains memory. Most Colors can be represented by RGB or CMYK. It is also possible to convert one color space to another and since the focus of this article is rendering things on a screen we will use the RGB model from now on

<- 1-1 The Canvas 1-3 Color Manipulation ->