60
$\begingroup$

In computer science, we reference colours using the RGB system and TVs have pixels which consist of groups of red, green and blue lines which turn on and off to create colours.

But how does this work? Why would certain amounts of red, blue and green light make something seem yellow? Is this a biological thing, where our brain performs some kind of averaging operation, or are the waves actually interacting to make light of a new wavelength?

It seems RGB is a "universal triplet", as every colour within the visible spectrum can be created by combining the three in different intensities. Is RGB the only such triplet? If so, why? If not, what features must a triplet of colours have to be universal?

$\endgroup$
  • 4
    $\begingroup$ More on perception of colours. $\endgroup$ – Qmechanic Aug 30 '18 at 10:22
  • 2
    $\begingroup$ See also this post on how we see colour. $\endgroup$ – user21820 Aug 30 '18 at 11:08
  • 2
    $\begingroup$ Impossible colors might interest you. $\endgroup$ – IllidanS4 Aug 30 '18 at 22:38
  • 1
    $\begingroup$ You might also be interested in a A Better Default Colormap for Matplotlib - a practial application for this work with some explanation $\endgroup$ – Ben Aug 31 '18 at 18:03
  • $\begingroup$ While not answering your questions, still fascinating info: Color does not exist & is nothing more than a psychological construct created by the brain (easiest way to show this is with the color pink: wavelengths required to make it are on opposite ends of the spectrum [IR & UV]), which is why no two people see color the same way. There's been ~150 documented cases of individuals able to see into the UV spectrum, with Monet being the most famous example, whereby we're able to see precisely when his vision was affected through his paintings, and primates are the only mammals that can see red. $\endgroup$ – JW0914 Sep 1 '18 at 14:56
86
$\begingroup$

Color perception is entirely a biological (and psychological) response. The combination of red and green light looks indistinguishable, to human eyes, from certain yellow wavelengths of light, but that is because human eyes have the specific types of color photoreceptors that they do. The same won't be true for other species.

A reasonable model for colour is that the eye takes the overlap of the wavelength spectrum of the incoming light against the response function of the thee types of photoreceptors, which look basically like this:

Image source

If the light has two sharp peaks on the green and the red, the output is that both the M and the L receptors are equally stimulated, so the brain interprets that as "well, the light must've been in the middle, then". But of course, if we had an extra receptor in the middle, we'd be able to tell the difference.

There are two more rather interesting points in your question:

every colour within the visible spectrum can somehow be created by "combining" the three in different intensities.

This is false. There is a sizable chunk of color space that's not available to RGB combinations. The basic tool to map this is called a chromaticity plot, which looks like this:

Image source

The pure-wavelength colours are on the curved outside edge, labelled by their wavelength in nanometers. The core standard that RGB-combination devices aim to be able to display are the ones inside the triangle marked sRGB; depending on the device, it may fall short or it can go beyond this and cover a larger triangle (and if this larger triangle is big enough to cover, say, a good fraction of the Adobe RGB space, then it is typically prominently advertised) but it's still a fraction of the total color space available to human vision.

(A cautionary note: if you're seeing chromaticity plots on a device with an RGB screen, then the colors outside your device's renderable space will not be rendered properly and they will seem flatter than the actual colors they represent. If you want the full difference, get a prism and a white-light source and form a full spectrum, and compare it to the edge of the diagram as displayed in your device.)

Is RGB the only such triplet?

No. There are plenty of possible number-triplet ways to encode color, known as color spaces, each with their own advantages and disadvantages. Some common alternatives to RGB are CMYK (cyan-magenta-yellow-black), HSV (hue-saturation-value) and HSL (hue-saturation-lightness), but there are also some more exotic choices like the CIE XYZ and LAB spaces. Depending on their ranges, they may be re-encodings of the RGB color space (or coincide with re-encodings of RGB on parts of their domains), but some color spaces use separate approaches to color perception (i.e. they may be additive, like RGB, subtractive, like CMYK, or a nonlinear re-encoding of color, like XYZ or HSV).

$\endgroup$
  • 4
    $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. Please remember that comments are for criticizing and improving the post being commented on, not for mentioning tangentially related tidbits. Please also remember to assume good faith on the part of other users. $\endgroup$ – ACuriousMind Aug 30 '18 at 18:23
  • 2
    $\begingroup$ Some further comments have also been removed. Some of those did improve the answer, as requested; thanks! If you find yourself wanting to have a discussion about how commenting should work, let's do that on Physics Meta. $\endgroup$ – rob Aug 31 '18 at 22:54
26
$\begingroup$

In the eye's retina there are three types of cones that act like the filters in the figure, spanning fairly wide frequency bands.

There you can see that pure yellow light will stimulate both "red" and "green" cones.

So, by getting light from nearby pixels of red and green, the retinal cones will respond the same way as it would from pure yellow, if the mix is right.

So it is very much a biological thing. Notice that a wavelength that stimulates a green cone will also stimulate at least one of the red and blue cones. We could thus imagine artificially stimulating only green cones (with electrodes) and might then see a so-called impossible color.

As for RGB alternatives, yes there are other color spaces that can be used to similarly mix to all the possible colors (as defined by the human retina).

enter image description here

Note that RGB screens typically cannot reproduce all colors. The image below shows the triangle of limitation on a typical screen. Professional screens tend to cover more, but rarely all colors.

enter image description here

$\endgroup$
  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$ – ACuriousMind Aug 30 '18 at 18:26
  • $\begingroup$ Actually colors along the purple line only exist in human perception, they are not singular physical phenomena, but rather interpretations by our eyes of the simultaneous stimulation of red and blue cones. Some consider those to be “impossible” colors. $\endgroup$ – Todd Wilcox Sep 2 '18 at 6:16
  • $\begingroup$ @ToddWilcox that sounds logical, and at the same time, blows my mind. After all, red and blue are at opposite ends of the visible wavelength spectrum but right next to each other on a colour wheel. Do you have a source to confirm it? $\endgroup$ – craq Sep 3 '18 at 4:18
18
$\begingroup$

The other answers by bernander and Emilio Pisanty already explains how eyes capture light and transform it into electrical impulses. There are few more things to understand. My answer will focus mostly on question 1 as the question 2 is already fully covered.

Light is a combination of multiple wavelengths

If you take any light, it actually is an electromagnetic wave (I'm oversimplifying here, but otherwise we'll not get anywhere). The trouble is there is hardly any source of light that produces just one wavelength (lasers do). So essentially the light is a combination of many different wavelengths. To see it you need to use a prism that splits the light beam into each of the wavelengths separately. This is essentially why we see a rainbow - water drops work as natural prisms and the Sun light is pretty much combination of (almost) all visible wavelengths.

If you use more than one source of light, on each of the wavelengths you'll have a sum of light coming for it from each of the sources. In other words if we imagine three lasers, red, green and blue, each of them producing exactly one wavelength, if we intersect their beams in one point and put a screen there, it will be a single point lit with those three wavelengths at the same time. We will not see three colours there, it will be just one spot with one colour. What colour will it be? I'll get back to that later.

Eye receptors capture if there's light only (and its strength)

This is tricky. There are basically 4 types of receptors on eye retina. One (rods) is responsible for recognising any visible(1) wavelength, and three responsible for spotting light within just part of the visible wavelengths range. They react more to the light that is closer to its optimum wavelength (which depends on the receptor/cone type - either red, green or blue, as already explained by others) and the farther the light wavelength is from this optimum the weaker is the reaction. I'll ignore rods responsible for any light since it is used mostly when there is not enough light for the other three (cones) to operate (that's why we see everything in shades of grey in a very dim light).

The receptors cannot tell which wavelength it have captured. If for a single receptor there is just a weak beam of its optimal wavelength or a strong beam but at the edge of what is noticeable - single receptor will just recognise as a pretty much the same amount of light. And produce impulse for the brain.

It's brain that decides what to do with the information

This is the most tricky part. Very, VERY tricky. The thing is brain receives impulses from different eye receptors and combines them. Based on what it has learned in the past (aka experience) it presents to your consciousness something known as a colour.

If you use a single wavelength light, your cones will react in a specific way. That way your mind can learn (from rainbow!!!) those colours. Now if a combination of many wavelengths produce similar cone reaction, the mind will not be able to understand there were multiple wavelengths and just show you the colour it knows from single-wavelength light that produces the same cones reaction. So if the combination of signals coming from eye receptors show there is some red and green light (i.e. those two types of cones produce strong signal exposed to some light) but not much blue then your mind interprets that there must be something you know as yellow. Note - it doesn't matter if the light was just only a single yellow wavelength beam, one single strong wavelength of red and one single strong wavelength of green combined or it was a combination of many wavelengths that made both green and red cones react. Your mind has just 3 signals and based on that has to tell what colour it is.

So if you properly balance the three laser beams mentioned earlier you might end up with a white dot, but you may also end up e.g. with a yellow dot. Or a brown dot. All depends how the cones will react to each of the used wavelengths and how strong will the reactions be.

And that's pretty much how RGB works

What is tricky here is that some combinations of wavelengths produces a combination of cones' responses that are different to any of the single-wavelengths light responses. Your mind still has to interpret it somehow so it presents it to you in some way different to any colour existing from the physical perspective. That way we can see colours like brown or grey.

What about that experience

As already mentioned, the basics is that what colour you'll see will be the relation to previous experience - if the cones reaction to combination of multiple wavelength is similar to a known single wavelength colour reaction you will see that colour. If not you will see something else (but again in a repetitive fashion(2) - but read further).

You can find several optical illusions related to colours or shades of grey. One of the famous recent examples seen in the internet was a dress on a photo that some interpreted as blue and black in strong light while others white and yellow in a shade. If you go in a very dim light into the woods you'll see the leaves faintly green even though your cones do not get enough light to work and all you see is actually a bit of light at all (so some grey). Yet your mind knows that leaves should be green so it sort of paints them for you. If you come back later in a full light you might actually see that some of those green leaves are red or yellow. But our mind tried its best to fill in the gap and used experience to add a colour. It's even more messing with things when the light is not white - mind still uses experience and adapts to the light (to some level) - so green will still look green in red light of a sunset.

So why RGB works?

Simply speaking the light used in each of the light sources causes specific (to some level predictable) reaction of cones as described above. As it can produce most of the possible cones' reactions, as a result you can see most of the colours on a TV/monitor screen.

TL/DR

What you see is a combination of what light gets to your eyes, how eyes make from it electric impulses that reaches brain and how brain interprets it based on the earlier experience.


(1) we call it visible because our eye receptors are capable of noticing it. so it should maybe say "some wavelength range that we call visible. Again, there is a bit of simplification - cones might have slightly broader wavelength coverage than rods. Also this might slightly vary across various humans but those differences might be disregarded. On the other hand other species respond to different wavelength ranges, e.g. dogs have just two types of cones so they essentially see less colours.

(2) it's also interpreted so that the colours that produce just a slightly different cones reaction seem quite similar (shades)

$\endgroup$
  • 1
    $\begingroup$ "Light is a combination of multiple wavelengths" Sometimes. Sometimes not. No individual photon exhibits more than one frequency/wavelength. And there is such a thing as coherent light, with all its constituent photons exhibiting the same wavelength/frequency. The eye can't always tell if it's perceiving a single color or a combination of colors. $\endgroup$ – Beanluc Aug 30 '18 at 21:44
  • $\begingroup$ @Beanluc that was a conclusion from the previous sentence, literally "The trouble is there is hardly any source of light that produces just one wavelength (lasers do)." Since lasers can do that (also prisms) then obviously it is possible but unlikely and essentially in most cases there is a combination of multiple wavelengths. I am also referring to cases with coherent light (just not referencing it by name) so I doubt it will lead to a confusion. And your conclusion is also in my answer: "The receptors cannot tell which wavelength it have captured." (and what comes next). $\endgroup$ – Ister Aug 31 '18 at 7:20
  • $\begingroup$ Rods actually do function to detect color in mesopic vision. That is, vision when light is weak enough that rods are not saturated but not so weak that it no longer elicits a response in cones. In that narrow range, rods give us an additional primary color that is blueish. $\endgroup$ – forest Sep 1 '18 at 0:14
8
$\begingroup$

There are both physics and biology at work here.

Basic physical properties of light

The first thing to understand is that light has a property known as “wavelength,” since light is an electromagnetic wave. The wavelength is the distance between two crests of that EM wave. As you might imagine, the distance is extremely small, usually measured in nanometers, at least for visible light (more on what makes it visible in a moment).

Basic biology of vision

The human eye, meanwhile, has special cells called “photoreceptors,” which are sensitive to light and trigger nerve cells to send a signal to the brain when light hits them. More light on them, stronger signal (simplifying a little here, for the record). However, photoreceptors are only sensitive to light with certain wavelengths. If light has a wavelength that none of our photoreceptors are sensitive to, we can’t see it—so visible light is just the light that we do have photoreceptors for.

Visible light spectrum

This graph shows the various types of light we recognize based on its wavelength, with the wavelengths that are visible to typical humans highlighted:

Wikipedia EM Spectrum

(Wikipedia EM Spectrum)

The important thing you want to notice here is that yellow is in between red and green. That is a key part of why mixing red and green produces yellow, but it’s not the full story. It’s the physical reality that our biology is trying to tell us about, but how our biology does that plays a bigger role.

Biology of color vision

Human photoreceptors are broken up into two primary categories—rods and cones—and then the cones, which handle color, (usually1) come in three varieties: those most sensitive to red wavelengths, those most sensitive to green wavelengths, and those most sensitive to blue wavelengths. Hence RGB. We see something as red because when the red light hits our photoreceptors, the red-sensitive cones are the ones that activate most. Same with green light activating our green cones.

It’s important to note that the cones’ sensitivity isn’t sharply defined; instead, they are just most sensitive to some color, and then get progressively less sensitive as the wavelength moves away from that color. And the sensitivities of the different cones overlap. So even with green light, your blue cones and red cones are still activating—just not as strongly as the green ones.

Here’s a diagram of a typical human eye’s photoreceptor sensitivities:

Wikipedia Color Sensitivity

(Wikipedia Color Sensitivity)

Yellow light, or red and green light?

And that is how the eye can give the brain information about light that isn’t red, green, or blue: if yellow light hits the eye, the red cones and the green cones will both be activated. The brain gets the signals from the red cones and green cones (and the lack of, or weaker, signal from the blue cones), and interprets that as “yellow,” that is, light with a wavelength in between the peak sensitivities of the red and green cones.

But the only information the brain really gets is that the red and green cones are activated. That could be because of yellow light, but it also could just be red and green light hitting the eye at the same time. The brain does not have the information it would need to know the difference, and so it just treats those two situations the same—as what we call “yellow.” That’s why you can output red and green (and not blue), and have the eye see yellow without having to actually have a yellow light source. And the eye does this with all colors; because the cones’ sensitivities overlap, there is always some kind of mix of signals that the brain combines into a single color, usually something like the “average” among them.

Red and blue light—definitely not green

An important exception to that “averaging” (which isn’t strictly an average, mathematically speaking) is when you have red and blue cones activated, but green cones not (as strongly) activated. Unlike the situation with yellow—where the brain had no information about whether it was seeing yellow light or a combination of red and green light—the brain does have information telling it that the green light isn’t present, because the green cones aren’t as strongly activated. So “averaging” the red and blue to make green would be really wrong—that’s the one color the brain knows isn’t there.

Instead, the brain perceives the combination of red and blue as magenta, a color that does not exist on the actual EM spectrum. No single wavelength of light appears magenta to us: only the combination of blue and red lights can cause us to perceive that color.

RGB “universality”

No, RGB isn’t universal.

First, light sources combine “additively,” that is, if you take some light and add a new light of a different wavelength, the new wavelength is added to the combination.

Dyes, though, combine “negatively,” that is, when you mix dyes together, you are removing more wavelengths from it. The reason for this is that dye absorbs some light and reflects others—white light is how we perceive a mix of all the wavelenths we can see, so if white light hits red paint, the blue and green wavelengths get removed and only red is reflected back at our eye. That’s why the primary colors you learned in grade school are red, blue, and yellow,2 with green formed by mixing blue and yellow together. It’s also why printers prefer to use CMYK over RGB: Cyan-Magenta-Yellow is a better place to start removing wavelengths than Red-Green-Blue are (Black is handled separately just because black is particularly important in printing and you want to separately make a really good black rather than trying to use all your other inks trying, and failing, to remove all wavelengths).

There are also other approaches to handling light, that don’t directly have anything to do with wavelengths, but rather more based on how you want the light perceived. Hue, Saturation, and Lightness, for example, will produce colors of a some wavelength or combination of wavelengths, but the numbers aren’t the intensity of lights of different wavelengths the way they are for RGB or CMYK.

Finally, none of these actually covers the entire spectrum of colors that the human eye can see. That’s because natural light covers a continuous spectrum of wavelengths, that is, the number of wavelengths in, say, sunlight is literally uncountable,3 and our photoreceptors are still somewhat sensitive to the colors around their peaks so our eyes can pick up on some of those wavelengths. RGB specifies combining just three wavelengths at different intensities, and there are simply always going to be colors you can’t make with just three wavelengths. You could add more wavelengths, but that means more independent light sources, and you certainly aren’t ever going to have infinitely-many of them. But three is pretty good; the four-color TVs didn’t really take off for precisely that reason.

This diagram shows the colors you can make with a typical RGB set-up, with the large gray area around it all the colors you can’t make.

Wikipedia sRGB Gamut

(Wikipedia sRGB Gamut)

Note that the arc along the top is the spectrum of monochromatic colors, that is, the light made up of just one wavelength—the spectrums in the above diagrams would be wrapped around that curve. And magenta forms much of the line connecting the bottom two ends of the curve.


  1. Color blindness occurs when some of those cone cells don’t work, or at least don’t work well. There have also been a few reports of people with four types of cones. And other species can have entirely different sets of photoreceptors with entirely different sensitivities, allowing them to perceive more colors that would look the same to us, and also allowing them to perceive light that is simply invisible to us.

  2. If, like me, you learned the primary colors with some kind of paint, that mixing is actually more complicated than just being straight “negative,” but for grade-school children it’s good enough. For this answer, I’ll stick to dyes, which are physically closest to just being the simple negative case.

  3. Practically speaking, anyway. Quantum mechanics might suggest that all light has a wavelength that is a multiple of some incredibly small distance, possibly the Planck length, but this isn’t anything anyone’s really nailed down a theory for, much less shown it experimentally.

$\endgroup$
  • $\begingroup$ Dyes mix negatively. Paints mix weirdly, since they contain some materials that absorb light and other materials that reflect it. If there is a blob of pigment near the surface of the paint that reflects blue light, blue light that hits the paint at that spot will be reflected even if the paint contains other pigments that would absorb any blue light that hit them. $\endgroup$ – supercat Aug 31 '18 at 16:49
  • $\begingroup$ Thanks for the part about magenta! Small typo (too small for me to edit) in the "Biology of color vision" section: when listing the wavelengths to which the cones respond, blue is mentioned twice in lieu of red. $\endgroup$ – zahbaz Aug 31 '18 at 16:53
  • $\begingroup$ @supercat Thanks! I’ll correct that, that’s a great point. $\endgroup$ – KRyan Aug 31 '18 at 17:37
  • $\begingroup$ Dyes simply absorb light, and mix negatively. Paints are different from dyes, and reflect some light while absorb some. The way that typical red, yellow, and blue paints absorb and reflect light will allow them to be mixed to produce other colors, but that depends upon the paints' composition and not merely their apparent color. $\endgroup$ – supercat Aug 31 '18 at 18:34
3
$\begingroup$

Light is a continuous spectrum

By "light", I mean the electromagnetic wave out in space. It doesn't matter whether it comes from a luminous source, is filtered by a transparent/translucent object, or is reflected by an illuminated surface; the interpretation of color of the light is the same.

The wavelength of light isn't limited to just red, green, or blue. There are an infinite number of wavelengths possible in between, so we say it is a "continuous" spectrum. In fact, the wavelength can be outside the range that we can see; that just makes it invisible. Most light is actually a mixture of many wavelengths.

We can see the continuous spectrum of light by using a prism, diffraction grating, or spectrophotometer.

Human perception reduces color to three values

Instead of having to process an infinite number of values, the human eye reduces color down to three values: red ($r$), green ($g$), and blue ($b$). This is done by the cone cells of the eye's retina; each one appears under the microscope as either red, green, or blue. The red cones process red light, producing a signal $r$ that increases with the intensity of the light. They also respond to nearby wavelengths such as orange and yellow, just not as strongly as red wavelengths. A similar process happens for the green and blue cones. The responses of each set of cones to each of the wavelengths is illustrated in this graph:

[cone spectrum]

One wavelength of light

Suppose you turn on a yellow LED, with a wavelength of 570 nm. Your spectrophotometer reports that there is a single wavelength (*1) of light, at 570 nm.

The light partially stimulate the red cones of your eye, producing a signal of $r=9000$. (See graph below. Don't worry about the units; they are arbitrary.) The light also stimulates the green cones, producing $g=8000$. They don't stimulate the blue cones, so $b=0$. Your brain receives the signals $(9000, 8000, 0)$ and interprets this as "yellow".

cone spectrum, one wavelength

Two wavelengths of light

Now suppose your computer screen produces a yellow color by emitting some red (600 nm) and some green (535 nm) light together. The red light hits your red cones, producing a signal of 6000. But the green light also produces some signal on the red cones, say 3000. The two signals add together to produce $r=6000+3000=9000$. Similarly, the green cone may produce a signal of 2500 from the red light, and 5500 from the green light, so $g=2500+5500=8000$. Neither light stimulates the blue cone, so $b=0$.

cone spectrum, two wavelengths

Your brain receives the signals $(9000, 8000, 0)$ and interprets this as the same yellow color as the LED. However, the spectrophotometer measures light with two different wavelengths. You perceive the colors to be the same, even though they have different spectra.

Generalizations

  1. This isn't the only way to produce the same perception. I could have mixed 625 nm red and 550 nm green to produce the same "yellow". All we need is to produce the same $(r,g,b)$ signals to fool your brain into thinking it is the same color.

  2. You can do this with more than two wavelengths, and still get the same perception. For example, yellow starlight is a combination of many wavelengths. The math is more complicated, but it can be done.

  3. Much of the light we see is a continuous spectrum. You'll need calculus to deal with the infinite number of wavelengths, but the calculations can be done.

  4. Since the dawn of history, humans have practiced the art and science of fooling ourselves into perceiving various colors.

  5. Even though you can't tell the difference between these various kinds of yellow light, the spectrophotometer can tell the difference. That shouldn't be surprising, considering that your eyes have reduced the information in infinite number of wavelengths down to just three values.

  6. The way an animal perceives color varies with the species. Primates (e.g. humans, other apes, monkeys) have three cones: red, green, and blue. Other mammals have only two cones: yellow and blue. So your cat or dog can't tell red or green apart, much less all of the forms of "yellow". On the other hand, reptiles and birds see in four colors. You aren't fooling your pet parakeet with your "yellow" LED and computer screen!


(*1) Technically, LEDs produce a narrow range of wavelengths around the chosen color, but that is not significant to this discussion.

$\endgroup$
1
$\begingroup$

It's an averaging thing. We have three kinds of colour detectors (cone cells) in our eyes whose spectral sensitivities overlap somewhat: there is a picture of the spectral responses in this Wikipedia article. You can see from this that monochromatic (single-wavelength) yellow light will cause both the red and green cones to 'see' the light, and what we interpret as yellow is therefore simply the combined response of these two cells in suitable proportions.

If, instead of monochromatic yellow light, we send a suitable mixture of monochromatic red and green light into the eye, we can cause the same response from the red & green cone cells (I think you need to be careful that the green is not too short wavelength or you'll be unable to avoid the blue cells firing too). And the eye/brain can't distinguish these two cases, at all, so we interpret that as yellow as well.

The answer as to what makes a 'universal triplet' is that it needs to correspond with the colour sensitivities of the cones in our eyes. There's nothing 'universal' about it in any physical sense.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.