Galaxy demo

As a slight departure from my usual projects I thought it would be nice to see an animated galaxy model. I was hoping that there would be star coordinate data freely available on t’interwebs, Hipparcos is one, but the data is only for relatively nearby stars so you just end up with a sphere of stars centred on the Sun - not very interesting.

So I changed tack and re-used my terrain mesh building code to load a picture of a galaxy as a height-map. I used this one (can’t remember which galaxy it is though):

Obviously there is no ‘height’ as such in a flat image, to generate the galaxy disk and bulge I randomized the vertical coordinates, with the range being higher in the bulge and tapering off towards the edge of the disk. The colours of the ‘stars’ are the pixel colours in the image, after discarding pixels with a total luminance below a certain threshold, i.e. the resultant model does not have a ‘star’ for every pixel of the image, only the brightest ones.

Here’s a side-on view:

Edge on:

Close-up:

The galaxy model is rendered using a ‘point cloud’ mesh re-used from my particle system code, each ‘star’ is a point-sprite with the shader creating a imposter sphere, blended with the stars behind it and ordered by distance. With the cut-off threshold I applied there are about 50K stars in the model and it renders way above 60 FPS, though obviously goes slower as more stars are added.

I’m quite pleased with the results for what turned out to be relatively little work using (largely) existing code. It’s far from perfect and there’s plenty more that could be done: it doesn’t look too great close-up (perhaps to be expected), and the blending can look a bit clunky sometimes (need to experiment with other functions). I’d be interested to see if anyone else has tried anything similar.

  • chris

The structure matches our own galaxy. The short central bar, and the branching arms match quite well. There sure are enough barred spiral galaxies which looks similar, but bets are that this is a visualization of our own galaxy.

[quote=“Varkas,post:2,topic:40969”]
Expect you’re right, I think I remember finding that image when searching for Milky Way star data, and our galaxy is suspected to be a barred spiral.

Its not our galaxy. It is one that is like ours… we think. Remember we only decided it was a bar galaxy pretty recently.

The star catalogs work for close stars. That is ones where we can measure the distance via the parallax method. This works out to a few 100lty IIRC. The milky way is about 100,000lty across, and contains something like 100 to 400 billion stars.

Interesting approach.