Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Is anyone aware of any code to procedurally generate star fields?

Ideally I'd like it to be physics-based so I can have realistic planets and moons. Best would be in C++, open source, and workable with Ogre3d.

I'm not afraid of coding something from a university paper if there's nothing available.

share|improve this question
2  
What do you mean by "field"? A cluster of stars, a galaxy, cluster of galaxies? Only a star with some planets? –  Maik Semder Jul 17 '11 at 16:38
2  
I'd like to create a skybox for a game. I'd like the night sky to behave in a little more realistic manner. Since stars don't change you could generate a static skybox image for them from a star catalog (or just randomly). The planets move slowly so periodically you could update their positions procedurally. A moon would change a lot so you would procedurally generate it more often. The moon would also need some image processing since it will be much larger than just a pixel. –  Jay Jul 17 '11 at 16:52
1  
This has a load of good material: vterrain.org/Atmosphere –  Jay Jul 17 '11 at 16:54
2  
A lot of what you need will be based on your travel speeds, are you sub-c or super-luminal, is this pure skybox or are you flying through entire galaxies? What is your scale? –  Patrick Hughes Jul 17 '11 at 17:41
1  
I don't need to emulate relativistic effects. Nothing will be moving that fast. The osgEphemeris for flight simulators looks like a great starting point –  Jay Jul 17 '11 at 18:31

1 Answer 1

up vote 8 down vote accepted

I believe that producing a star field (long range) and planets and moons ("short range") should be two different layers. As for the star field, I've found this to be useful for my game: http://alexcpeterson.com/spacescape. That can take care of your long range, static star field. It's written in C++ and open source.

As for the "short range" stuff. I've found some sources for solar system simulators, but from my shallow glance, they don't look very generic, if you're wanting to create a different solar system than our own. I put the links at the end.

In reality this shouldn't be too difficult of a task to create a generic system for planets. Study up on your Kepler and you can get some good estimations of planet positions. http://en.wikipedia.org/wiki/Kepler%27s_laws_of_planetary_motion. Probably just stick with simple non-eccentric orbits to start :)

Here's some links for solar system simulators I found.

http://astro.berkeley.edu/~dperley/programs/ssms.html

http://code.google.com/p/solar-system-cpp/

share|improve this answer
    
Your tool looks really helpful. Thanks for sharing –  Jay Jul 17 '11 at 20:30
3  
Not my tool, I just use it :) All the credit for the Spacescape tool goes to Alex C Peterson –  Byte56 Jul 17 '11 at 21:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.