Tag Archives: space

Pet Peeve of the Week: Starfield simulations are always wrong, and here’s why…

Ok, if you don’t know what a starfield simulation is, lets sort you now – look at the video below first.

Ok, for those of you without youtube, think then of the screen savers on early windows PC’s – you may recall the screensaver that makes it look like you are flying through space – this “stars flying by” visual is the thing I am talking about. If you are interested, you can presently download this screensaver here.

Now when this screen saver came out, I’ll admit I was still a bit of a nerd – with a thing for both astronomy and for computers, so I set out to make my own. What I learned along the way initially puzzled me then annoyed me and then made me give up in disgust.

Ok, so before I tell you the ‘big secret’ of what annoyed me so, take a look at this animation:

[youtube=http://www.youtube.com/watch?v=KJO88Qhxwv4]

I think you’ll agree it’s quite good – yes the stars are not perhaps as pretty in their distribution as some of the pictures from the Hubble (see below) but that is quite forgiveable.

Despite the boring uniformity of the stars, I want to draw your attention to the complexity involved in creating this animation. Just ‘guessing’ the paths of the stars by having them start small, somewhere near the middle, and then gradually grow and swing to one of the edges will not do. I tried this, trust me, it looked crap.

No, it turns out the only way to make this look decent is to do the honest thing and create a virtual 3-d world and then place the stars in it, then fly the camera through the space and have the computer figure out the paths for all the stars. Sound tricky? Well it bloody well was in 1995 when I tried it, though I reckon it’s easier now. I used POV-Ray to render hundreds of stills and then tried to create a loop to make an animated gif. It was only like 200-200 pixels and it took days to render but it eventually finished and looked – absolutely nothing like the windows screen saver.

You see, I made the school-boy error of distributing stars ‘realistically’ in my 3-D space – I put them proper distances apart, randomly, and I gave them realistic ‘sizes’ (relative to the inter-star distance). Instantly I had my first problem. The stars were all too small to even be detected by the renderer. Ok, so it turns out stars don’t work like normal things, their apparent size is not due to their actual size but a combination of their brightness and their distance. Fine. So I had to make them far bigger so they could be seen (which is utterly wrong wrong wrong to my purist heart).

Ok, so now I had spots. Did we get that sense of flight? No.

The next issue was that you needed only a few stars to create a ‘busy frame’ (say 20 stars), but most of them were stupendously far away and would stubbornly refuse to budge. The only option was the put absolutely bazillions of stars in the field so that at least a few were nearby enough for you to ‘swoosh’ lavishly past. Of course, to get that many stars, the whole view has to be completely plastered with stars – to the point of being a plain white screen. So I had to do another fudge – I had to create a sort of ‘fog’ that filtered distant light. This meant the viewer would only see nearby stars. Wrong wrong wrong again!!!! I happen to know from my own space travels (on spaceship earth) that we can see rather far without trouble, and thus this fog effect is a terrible hash.

However, I was getting somewhere with the sim. It looked like dots moving now. They did not get any bigger as they got closer, but they did move faster and get brighter, due to the fog. But damn, all the ‘nice’ starfield sims did have the stars actually getting bigger, so now I increased the size of the stars again – so big that the stars were literally only a few dozen diameters apart and hey presto, it now looked good.

binary stars

Stars are not happy bedfellows!

Now think about that – the stars were only a few dozen diameters apart. The earth is actually about one-hundred sun-diameters from the sun; so what we are talking about it a super dense space, rammed with stars. Wrong wrong wrong. Stars that close tend to get involved in all-out gravity war (see the picture!)

So it occurs to me that the nerdy folks who have a hand in creating those ‘nice looking’ simulations are probably aware of their dirty little crimes. These simulations are not simulations at all, they are but an ‘artist’s renditions‘. Now that is an insult of great proportion to any red-blooded computer programmer. All I can say is, you should have formatted that floppy when you realised what you were doing and moved on with your life. It’s too late now – I know your crimes and will not let you sleep easy tonight.

===================

Update, 2011…

Ok, I have that out of my system. The question is (it should be burning your lips): what does superfast space flight look like then?

To answer this well, you simply need to put more effort into the simulation – you need to consider the great asymmetries in the star distributions – think how small they really are, then think about their clusters, then spiral arms, then galaxies, then clusters of galaxies, then…

I have referenced this video before and I do it again unashamedly – take a look, because they have already done what I suggest…

[youtube=http://www.youtube.com/watch?v=0fKBhvDjuy0]

I think the makers should get a Nobel prize.

===================

Update 2012…

Ah, I am not alone in my nerd-dom. Now you can fly around in a pretty darn impressive virtual universe and see for yourself how the stars really actaully fly past. Happily, the results are not at all like most starfield simulators. You can fly vast distances with the sky literally ‘unmoved’. It is only once you come near a star or star cluster that those few will move, and only when you are moving stupidly fast yourself (like 2 parsecs per second) in a dense part of a galaxy, will you get anything like the old Windows starfield effect. My inner nerd feels justified. You can run the simulator on your own PC, get it at:

http://en.spaceengine.org/

Or read about it at io9:

http://io9.com/5924776/new-simulation-is-as-close-to-traveling-through-space-as-it-gets

Amazingly, this has been in the works for some time – this video from the sim was uploaded in 2009 already, it gets to the starry stuff in the second half:

[youtube=http://www.youtube.com/watch?v=7qDnoHRBItg]