Spectral Rendering: Why Three Numbers Aren't Enough - Computing Color the Way Light Really Works
We built this whole library on a quiet truth: color is a spectrum, but your eye - and your screen - reduce it to just three numbers. Almost all of computer graphics runs on those three, and most of the time it works. But sometimes the shortcut lies: a colored light bounces off a colored surface and RGB gets the answer wrong; two objects that matched under daylight drift apart under a lamp; a prism refuses to make a proper rainbow. To fix these, film and science reach back to the full spectrum. This final chapter is about computing color the way light actually behaves.
The three-number bottleneck
Light arriving at your eye is a spectrum - a continuous curve of power at every wavelength. But you have only three cone types, so your visual system collapses that infinite curve into three numbers. Screens exploit exactly this: three primaries, three numbers, and the eye can't tell the difference. It is a brilliant compression - and the foundation of nearly all digital color.
The catch is that light doesn't interact in three numbers; it interacts wavelength by wavelength. When light reflects, transmits, or mixes, the physics happens across the whole spectrum, and only afterward does the eye summarize the result. Do the math in RGB and you are summarizing first and interacting second - the wrong order. Usually the error is invisible. Sometimes it is glaring. Spectral rendering keeps the full spectrum through every bounce and reduces to three numbers only at the very end, the way reality does.
When RGB multiplication lies
Here is the most common shortcut in all of graphics: to light a surface, multiply the light's color by
the surface's color, channel by channel - out = light × surface in RGB. The correct
answer multiplies the two spectra wavelength by wavelength, then reduces to color.
For gentle spectra the two agree; for saturated lights and surfaces they can part ways. Try
combinations and watch the gap.
Two ways to bounce light off a surface
Choose a colored light and a colored surface. The left swatch is the correct spectral result (illuminant spectrum × reflectance spectrum, then reduced to sRGB through the CIE colour-matching functions). The right swatch is the naive per-channel RGB multiply. ΔE is how far apart they land - small for broad colors, large for saturated ones.
The metamer twins
Because three numbers can't capture a whole curve, different spectra can share a color. These are metamers. Below are two surfaces with genuinely different reflectance spectra, yet under daylight they are the exact same color to your eye - the colour-matching functions integrate both curves to identical values. RGB stores only that shared color and throws the spectra away.
Two curves, one color
The two reflectance spectra are constructed to be exact metamers under daylight - one smooth, one with an added "metameric black" wiggle that the eye's response integrates to zero. The single swatch is the color they both produce under daylight. Different physics, identical perception.
Relight them, and they split
Now the punchline. Take those two metamer twins - identical under daylight - and change the light. A spectral renderer multiplies each true spectrum by the new illuminant and correctly shows the twins drifting apart. An RGB pipeline, holding only the one shared color, keeps them locked together and renders the relit scene wrong. Flip the light and watch them separate.
The twins come apart under a new light
The same two surfaces from above, now rendered spectrally under the light you choose. Under daylight they match (ΔE near zero). Switch to a warm bulb or a spiky LED and their different spectra reflect differently, so the twins visibly separate - exactly what a spectral renderer predicts and an RGB one misses.
The rainbow RGB can't make
One last thing only spectra can do. In glass, the refractive index depends on wavelength - blue bends more than red - so a prism fans white light into a spectrum. That is dispersion, and it needs every wavelength tracked separately. With only three fixed samples, RGB can fake a three-band smear at best; a spectral renderer produces the smooth, true rainbow - and the fire inside a diamond. Send white light through the prism.
Splitting white light by wavelength
White light enters a glass prism and each wavelength refracts by its own amount, following the
Cauchy relation n(λ) = A + B/λ² - shorter (bluer) wavelengths bend more. Adjust the
glass dispersion and watch the spectrum fan out. RGB's three samples can't bend independently;
only the full spectrum makes a true rainbow.
The terms, defined
The vocabulary of computing color from light.
n(λ)) that splits white light
into a spectrum - renderable only with per-wavelength tracking.What it means - and a farewell
Test your understanding
Six questions on spectral rendering, RGB's limits, metamers, relighting, and dispersion - the finale quiz. Instant feedback, no scores recorded; a wrong answer comes with a short explanation.
Quick check
Continue your journey
The spectral thread began at the very start of this library. Follow it back to its roots, and out to where it's used - a fitting loop to close on.
Spectral Power Distributions and Why RGB Is Not Enough
Where this whole thread began.
Colorimetry · 11Metamerism Explained
The concept behind the twins.
Colorimetry · 10Chromaticity Diagrams Without the Intimidation
How spectra become points of color.
Colorimetry · 88Color Rendering: Why Two "White" Lights Reveal Colors Differently
The illuminant side of the same physics.
Digital · 83Color in Real-Time 3D: Albedo, PBR, and Tone Mapping
Where RGB rendering usually happens instead.
Physics · 112The Color of Heat
The spectra of the lights we render with.