This page has Partiview-format x y z positions and colors of 74000+ stars in the Milky Way, and documentation on how this data was assembled.
Star positions came from data originally provided by the Hipparcos project. However, that only gave ra and dec values, and I didnt know how to get distances from parallaxes at 2am with no-one around to ask (I'm not an astronomer), so I googled around and found David Nash's HYG Database v1.1. This is a database that is
"a subset of the data in three major catalogs: the Hipparcos Catalog,the Yale Bright Star Catalog (5th Edition), and the Gliese Catalog of Nearby Stars (3rd Edition)... containing all stars brighter than magnitude +9.0, or closer than 50 parsecs."
That's about 87000+ stars. This database comes under the Creative Commons license, so that should be fine since we're creating a (in its legalese) a Collective Work.
Each star comes with ra, dec, distance from the sun (in parsecs), spectrum, absolute magnitudes and other things which I didnt use. (I didnt use color indices for instance - initially I did, but didnt know how to get a realistic color map from that, so I did what's described below.)
Statistics for the stars were got with the perl script getstats_hygfull.pl.
The range of ra values was between 0 and 24, dec values between -90 and 90, absolute magnitudes between -11.06 and 19.63, color indices between -0.40 and 5.46. Most color indices were between -0.2 and 2. (Note: I'm including the color indices values for completeness.)
Ra and Dec and Distance-in-parsecs values were converted to x y z coordinates using the formulae (ra is in degrees, between 0 and 360, and dec is in degrees, between 0 and 180).
k = pi/180 x = dist*cos(ra*k)*cos(k*dec) y = dist*sin(ra*k)*cos(k*dec) z = dist*sin(k*dec)
Spectrums were more problematic; the file spectrum.dat has spectrum names and number of stars with that name in the HYG database.
I then needed to know how to map each star to a color. I used two possible methods.
"These are not magic values for pixel color. Each time I change the details of how things are handled, and then regenerate these web pages, different colors fall out. Quite similar, but different."
For our purposes, that's okay. Especially since what the colors are supposed to mean is (again, quoting Mitchell)
These colors attempt to show "true" color. That is: without intervening atmosphere or interstellar medium; with the light dim enough to avoid saturating your cones (which would make the light appear white); and yet with the light bright enough that you are seeing color rather than rod grayscale.
Mitch's file http://www.vendian.org/mncharity/dir3/starcolor/UnstableURLs/starcolors.html has RGB values given a star's type and class; I used these to allocate colors to stars. Didn't manage to allocate a color to every star, but 74000+ stars out of 87000+ stars is good enough for our purposes.
I then assumed that any star which just had a type quoted (e.g. B0) was a main sequence star (i.e. BOV in the same example).
This left cases like "F0IV/V", "K4/K5III", etc. For those I picked the first combination that worked.
I ignored markers like a, b, c, +, e.g. G0Ia was treated like G0I, A2+ like A2, etc.
The crappy Perl script spec2cmap.pl uses starcolors.txt to convert spectrum.dat to a cmap file spec.cmap where it can , leaving the remaining lines of spectrum.dat in todo.cmap (okay, it's not a cmap file. Wgasa, I'm tired.)
Note that to use spec.cmap as a Partiview cmap file, you need to add an initial line that says how many entries it has.
Finally, the Perl script processhygfull.pl processes spec.cmap and hygfull.csv (the file in the HYG v1.1 database) to get Partiview files.
Partiview files: hyg.speck, hyg.cf, hyg_pv.cmap, halo.sgi (generic star picture). These are almost the same files as produced by the above Perl scripts, but I added a few things manually, e.g. the sun. (Note: Need to know what the absolute magnitude of the sun is. Spectrum is ok, set to G2V.)
Version 1 received lots of complaints that star colors were too unrealistic. Whether this is true or not (and RGB values look different on different screens), I decided to settle with something that would result in less argument.
Mark Subbarao suggested the following RGB values based on star type:
type R G B O 00 66 FF B 33 99 FF A CC FF FF F FF FF FF G FF CC 33 K FF 66 00 M FF 00 00
Andrey Zhiglo made more suggestions:
As to particular colors (to Mark): I feel like F are not white, but yellowish (and Sirius is almost white, being A1; at leats A5 and later are hardly bluish, as the table suggests). ... if your spectral class/luminosity class is written as "M2 Ia" say --
a) neglect lum. class -- the spectral differences are hardly possible to reasonably represent in RGB scheme, and it's worthless (i am not an enthusiast now) to distinguish them by RGB color. So, leave only "M2" for assignment.
then, use Mark's numbers as exact for O5, B5, ... M5 classes. - I would though suggest FF FF FF for A5, and say FF DD 99 for F5. Then, if you have say A3, linearly interpolate it from adjacent classes: say, A3 is 2 units from A5, 8 units from B5 -- use weights 8/10*[a5]+2/10*[B5], that is 0.8*[FF]+0.2* = [D6] for [rr], 0.8*[ff]+0.2* = [EB] for gg etc. The problem might appear with extarpolation earlier than O5 (but you are unlikely to have such stars:) ) and M6-M9. If you meet the latter, assign FF 22 00 for M5, and extrapolate linearly from K5 and M5, you'll be safe.
In the end, it was late at night, and I said "to hell with it", and just implemented Mark's suggestion, but using FF DD 99 instead of FF FF FF for F-class stars. The Perl script processhygfull2.pl processes hygfull.csv and produces hyg_take2.speck compatible with the color map file hyg_take2.cmap.
Partiview files: hyg_take2.speck, hyg_take2.cf, hyg_take2.cmap, halo.sgi.
Just use the damn thing. Credit (not just to me, but also to Mitchell Charity and David Nash) would be good. All the usual caveats about using this at your own risk apply. This is something you should only use for outreach purposes, when you just need to say "Here are some stars in the Milky Way", not for serious scientific tasks.
To make galaxy flythroughs, we needed positions and colors of some stars in the Milky Way.
For our prototypes, we used the data in the file stars.speck in the Milky Way Atlas by B.Abbott & R.Drimmel in the Digital Universe. Unfortunately (but understandably), that information could only be used for free by people in educational establishments. As our flythrough-related products had to be freely usable by anyone (as long as due credit was given), whether in academia or commercial institutions like Adler Planetarium, I decided to reinvent the wheel and process the data on my own. Perhaps I should have waited for the AMNH lawyers to give us permission, but it was just easier this way.