I am trying to write a spaceship simulator. One problem I've hit into is how to best simulate the background of space with its stars. I don't need it to be faithful to the real thing with constellations and everything, but my attempt of uniformly distributing random points on the celestial sphere produced... unnatural-looking starry backgrounds, for reasons I can't put a finger on.

Is there a way to "realistically" distribute random "stars" in space? I'm language agnostic, so feel free to code in the language you're most comfortable with; I'll adjust. :)

  • $\begingroup$ IS taking the real star position data and pojecting it on your map considered realistic enough? $\endgroup$
    – joojaa
    Commented Aug 16, 2016 at 12:51
  • 1
    $\begingroup$ You can find data here: astronexus.com/hyg $\endgroup$
    – joojaa
    Commented Aug 16, 2016 at 12:57
  • $\begingroup$ Maybe calculate random 3D positions for the stars and then project them onto a sphere. Their brightness depends on the distance from the sphere center. $\endgroup$
    – tmlen
    Commented Aug 16, 2016 at 19:06
  • 4
    $\begingroup$ Maybe you could add a screenshot of your current results versus what you're looking for (e.g. a photo of a real starry sky that you'd like to imitate)? Otherwise, we're just guessing what "unnatural-looking" means here. $\endgroup$ Commented Aug 16, 2016 at 19:52
  • $\begingroup$ Maybe you could look into poisson sampling, you can define some density function and transform that into distributed points of fairly convincing random distribution. Check here devmag.org.za/2009/05/03/poisson-disk-sampling $\endgroup$
    – PaulHK
    Commented Aug 18, 2016 at 6:07


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.