With the help of a friend, Seán Ceallaigh, we built a graphics shader that simulates the light that hot objects give off - black-body radiation. This effect causes stoves to be red and stars to look whitish-blue.
The Science behind it
The heart of the algorithm is a function that takes a temperature and a wavelength and outputs the intensity. You can plot this on a graph to see what the light would look like. Below, each line represents the output of all wavelengths for a given temperature.
I convert the spectrum graph into the intermediary XYZ Color space. XYZ is somewhat analogous to how the cones in human eyes work, called the LMS Color Space. Changing from XYZ to RGB is a simple coordinate change which can be done with matrices.
Show me the money
Finally, after implementing all this magic, we allowed any object in our ray tracer to have a temperature and our corresponding black-body shader. Here are the initial results:
As you can see, each sphere has the correct hue as they increase in temperature. We quickly realized that our equation has a flaw; As temperature doubles, the energy emitted goes up 16 fold! This meant that the image was nigh-impossible to expose with our virtual cameras. We ended up using a mixture of HDR and scaling the intensity of light to reasonable bounds.
Lastly, we wanted to see what our shaders would do when using impossible physical constants, as well as other changes. This resulted in some crazy renders!