Color mixing ed

How do colors interact? What is "subtractive color mixing"?

Simplification: we'll assume that there are only 3 independent wavelengths (colors: red, green, blue). Real life is messier, because these 3 perceived colors can have some overlap in the spectrum.

Multiple light sources ed

For a single wavelength, the intensities (energy) from two sources will just add up.

Physical reason: the equations of light (Maxwell equations) are linear.

Three independent wavelengths will add similarly:\[ L_{\mathrm{out}} = L_1 + L_2 = \begin{pmatrix} r_1 \\ g_1 \\ b_1 \end{pmatrix} + \begin{pmatrix} r_2 \\ g_2 \\ b_2 \end{pmatrix} \]

Single light with matter ed

Transmission (transparent light filter) ed

Shining a single wavelength onto a transparent material, only a certain percentage will come out on the other side. The rest will be absorbed or reflected.

Physical reason: a thorough explanation would require some quantum field theory. Let's not do that.

For 3 color components, we can find 3 transmission factors \(0 \le R,G,B \le 1\), combined into a vector \(M\):\[ L_{\mathrm{out}} = M \cdot L_{\mathrm{in}} = \begin{pmatrix} R \cdot r \\ G \cdot g \\ B \cdot b \end{pmatrix} \]

Reflection ed

This can happen for different reasons: metals really reflect while most other materials reflect by diffuse sub-surface scattering (light entering the material, traveling some distance with filtering, and then exiting).

Either way, we get a single percentage for each color component and the same formula as for transmission.

Mixing materials (in an ideal world) ed

This is usually sloppily called "subtractive mixing". Sadly, the term is applied to several different situations, with very different behavior.

Multiple transparent filters (stacked) ed

We already know how to solve this:

Any light going through the first filter gets multiplied by its coefficients. Then, going through the second filter, we have to multiply again. Overall, this behaves like a single filter with the coefficients multiplied:\[ M_{\mathrm{combined}} = M_1 \cdot M_2 = \begin{pmatrix} R_1 \\ G_1 \\ B_1 \end{pmatrix} \cdot \begin{pmatrix} R_2 \\ G_2 \\ B_2 \end{pmatrix} \]

Examples
blue (0, 0, 1) and yellow (1, 1, 0) = black (0, 0, 0)

red (1, 0, 0) and orange (1, ½, 0) = red (1, 0, 0)

red (1, 0, 0) and cyan (0, 1, 1) = black (0, 0, 0)

In the real world with cheap filters we would get

blue (0, ¼, 1) and yellow (1, 1, ¼) = dark green (0, ¼, ¼)

Multiple transparent filters (mixed) ed

What if we really mix the materials from 2 filters?

First, what if we make a filter 50% thinner? The answer should be \(\sqrt{M}\), because stacking two thin filters should give the original one (\(\sqrt{M} \cdot \sqrt{M} = M\)).

Now, mixing two materials should (keeping the overall thickness) should give\[ M_{\mathrm{combined}} = \sqrt{M_1} \cdot \sqrt{M_2} \]

This might be roughly what happens if you mix 2 transparent liquids (water colors).

Now, the real world example becomes

blue (0, ¼, 1) + yellow (1, 1, ¼) = dark green (0, ½, ½)

Multiple strong pigments ed

If there are two types of reflective pigments, and each ray of light only gets reflected by exactly one pigment with 50/50 chances, we get\[ L_{\mathrm{out}} = M_1 \cdot \frac{1}{2} \, L_{\mathrm{in}} + M_2 \cdot \frac{1}{2}\, L_{\mathrm{in}} \]or\[ M_{\mathrm{combined}} = \frac{1}{2}\, M_1 + \frac{1}{2}\, M_2 \, . \]

Examples
red (1, 0, 0) and green (0, 1, 0) = yellow (½, ½, 0)

blue (0, 0, 1) and yellow (1, 1, 0) = grey (½, ½, ½)

red (1, 0, 0) and orange (1, ½, 0) = red-ish (1, ¼, 0)

red (1, 0, 0) and cyan (0, 1, 1) = grey (½, ½, ½)

Real world colors ed

Categories: Blog, Graphics stuff