[sci.astro] Spectral type -> RGB colors

jon@oddhack.UUCP (04/16/87)

    I need to convert the spectral types and magnitudes specified in
the Yale Bright Star catalog into RGB triplets suitable for display on
a color monitor. I would appreciate any algorithms, references, or
suggestions (in that order) on how to do this. 

    Thanks,
    -- Jon Leech (jon@csvax.caltech.edu || ...seismo!cit-vax!jon)
    Caltech Computer Science Graphics Group
    __@/

phil@brl-smoke.ARPA (Phil Dykstra <phil>) (04/20/87)

Here's the method I used:

The Yale catalog gives the B-V color index, I.
I converted these to color temperatures:

Tc = 7200 / (I + 0.64)  in degrees K

and then integrated Planck's black body radiation curve for
several temperatures against the CIE standard observer color
matching curves.  I converted these to xy chromaticity
coordinates.  Here's a table of some values with a set of
equal intensity RGB value for a "typical" monitor [Note that
in order to display a color "correctly" one needs to know the
gamma and phosphor chromaticities of their display device
and convert xy to match.  These make a BIG difference.]

Temp    xy chrom coords         Monitor RGB

 3000   0.4373  0.4042          212 106  31
 4000   0.3808  0.3770          173 117  65
 5000   0.3454  0.3518          151 122  96
 6000   0.3223  0.3320          137 124 121
 8000   0.2954  0.3050          122 126 159
10000   0.2808  0.2885          113 126 185
12000   0.2719  0.2778          109 126 203
15000   0.2638  0.2675          104 125 222
20000   0.2565  0.2578          100 124 241

The resulting colors look exaggerated, particularly at the
high end, but this is mostly due to the fact that the eye's
perception of color from a point source is very poor.  A
star is a much better point source than a pixel on a frame
buffer.  Looking at a "defocused" photograph of stars
will show that these colors are actually out there!
I have not determined a way to "correct" the colors for
this psycho-physical effect (other than pure cheating).

As for the brightness of the displayed pixels, most
monitors have a gamma near 2.5, and will therefore do a
nearly correct exponential magnitude->brightness mapping
for you!  Thus do a linear mapping of say, mag 6 through
-1, onto 1->255.

You could probably work from the spectral class as well,
but as long as you have a B-V value the above method is
probably easier.  It's fun by the way to make an HR
diagram from the Yale data.

- Phil
<phil@brl.arpa>
seismo!brl-smoke!phil