Colour

Hello, I want to do some experiments in colour.

The way we usually treat colour in computer graphics is as a linear combination of red, green and blue components. Indeed this is how it is displayed to us by our screens. However the light that reaches our retina and makes us perceive colour is actually made up of lots of individual photons. Each of these has a wavelength. The different wavelengths activate our light receptors on our retinas to different degrees.

Light from a laser contains photons of only one wavelength. Light from other sources (e.g. the sun) contains photons of varying numbers at all different wavelengths. This is called a spectrum.

The real-time graphic above tries to show the closest colour on your monitor that matches the colour of a laser at each wavelength. The shortest wavelength is on the left [390nm] and the longest on the right [830nm]. I used color matching functions to calculate the tristimulus values then the sRGB specification to translate that into the familiar red, blue and green components for your screen to display.

New CIE XYZ functions transformed from the CIE (2006) LMS functions Wikipedia - sRGB