15
\$\begingroup\$

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.

\$\endgroup\$
6
  • 2
    \$\begingroup\$ What do you mean by "field"? A cluster of stars, a galaxy, cluster of galaxies? Only a star with some planets? \$\endgroup\$ Jul 17, 2011 at 16:38
  • 2
    \$\begingroup\$ 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. \$\endgroup\$
    – Jay
    Jul 17, 2011 at 16:52
  • 1
    \$\begingroup\$ This has a load of good material: vterrain.org/Atmosphere \$\endgroup\$
    – Jay
    Jul 17, 2011 at 16:54
  • 2
    \$\begingroup\$ 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? \$\endgroup\$ Jul 17, 2011 at 17:41
  • 1
    \$\begingroup\$ 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 \$\endgroup\$
    – Jay
    Jul 17, 2011 at 18:31

1 Answer 1

10
\$\begingroup\$

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/

\$\endgroup\$
2
  • \$\begingroup\$ Your tool looks really helpful. Thanks for sharing \$\endgroup\$
    – Jay
    Jul 17, 2011 at 20:30
  • 3
    \$\begingroup\$ Not my tool, I just use it :) All the credit for the Spacescape tool goes to Alex C Peterson \$\endgroup\$
    – House
    Jul 17, 2011 at 21:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .