Converting Temperature to Color


Spencer W. Thomas (spencer@med.umich.edu)
comp.graphics.visualization, 01 Feb 1995

If no one else responds, here's how to do it from first principles:

  1. Find the equation for the black body spectrum.

  2. Convert the spectrum to RGB. See, e.g., Hall: _Illumination and Color in Computer Generated Imagery_, Springer Verlag, 1988. I bet there's code in an online archive to do this, too.


Spencer W. Thomas (spencer@med.umich.edu)
comp.graphics.visualization, 02 Feb 1995

Find the equation for the black body spectrum.

Ok. Here it is, from the CRC Handbook of Chemistry and Physics, definition of Radiation formula, Planck's:

The emissive power of a black body at wave length lambda may be written

    E(lambda) = c1 * lambda^(-5) / (exp(c2/(lambda*T)) - 1)

where c1 and c2 are constants, with c1 being 3.7402e10 microwatts-microns^4-per-cm^2 or 3.7403e-12 watt-cm^2, c2 being 14384 micron-degrees and T the absolute temperature.

If you're just looking for the shape of the spectrum and not the absolute brightness, you can, of course, ignore c1.