Jump to content
  • Advertisement
  • entries
  • comments
  • views

Distances and stars visibility

Sign in to follow this  


Several days have passed and StarDust moved thousands of light years away from the Solar System for now. The eliptical orbits of planets were done, but with some major changes in the system it looks the planets will maybe have to go around a star using physical simulation instead. Before the planets and other fun stuff can be made more in depth, it was necessary to solve a technical issue about a varying scale of distances. Everybody who tried to model at least a Solar System in 3D with some good precision knows that soon the distances will become so large that the precision is simply lost. The work on StarDust during the last days was about securing a precision of centimeters over a distance of 100,000 light years. With that is StarDust able to address any centimeter within whole Galaxy. If it really works will show up within few weeks.

The Milky Way galaxy is estimated to have about 100-400 billion stars. To be able come at least close to the real model the star generating system for StarDust had to be designed. The primary responsibility of the generator is to repeatedly create always same star on the same spot of the Galaxy. Everytime you move away from some constellation of stars and then come back, the generator must secure that you'll find any of the billion stars on the place saw them before. Secondary duty of the generator is to reduce the amount of stars your system have to process, even if it's within the visibility range. The need for this comes from the various visibility of stars. There are dwarf stars that are visible from only several light years away, and giants that you can see from hundreds of light years.


If the visibility would be set to several hundred light years, the system would get overhauled with thousands of dwarf stars that would be within the range, but would be useless because they don't cover even a half of pixel. On the other side if the visibility is set to just several light years, the system would breath freely but we wouldn't see the brightest stars of the sky that may be further than the dwarfs. The generator is thus responsible for generating the stars at the right moment, so large stars appear in greater distance and small stars appear only when the observer comes really close to them.

Here is a speeded up technical animation showing stars generator in action. In the animation is shown just one of the final 50 horizontal layers. The maximum visibility in the test was 210 light years. Stars have been enlarged so they can be seen better.



And what is next? Next step is adding remaining star layers and perform some adjustments to generated star radius and color. Probably some optimizations will be needed as the amount of work for he machine will multiply with stars expanding up and down. After that a corrections of star density based on real Milky Way shape is planned and override of star generator for area surrounding Sol, so real star data can be used for Earth's neighbourhood instead of the generated ones.

Well, for now that's all. See you next time.

Petr Marek

Sign in to follow this  


Recommended Comments

Very impressive project! Looking forward to your next update. Interesting stuff indeed....head hurts...have to leave now [img]http://public.gamedev.net/public/style_emoticons/default/blink.gif[/img]

Share this comment

Link to comment
Do you have any time to write about how you approached your star generation algorithms?

Share this comment

Link to comment
[quote name='evolutional' timestamp='1306754212']
Do you have any time to write about how you approached your star generation algorithms?

I've noticed now that although I wrote about it in later dev-log, I missed to write a reply here ^_^

So, the generation of stars is made using a fictional octree dividing the space area. Fictional because the structure is never stored (because of it's size). From the camera coordinates is calculated what index would have a leaf containing the camera in the tree. This index is used as a generator seed, securing that random function will for same sector always return same sequence of values - i.e. generate same stars.
Same calculation of index is made also for all nodes above the leaf with camera (i.e. parents of the node with camera).
If the index of some of the sectors containing the camera changed, the stars of that level are regenerated. E.g. if camera moves in a way it leaves the sector represented by a leaf, but still remains in the same larger sector represented by the leaf's parent, only the stars for the new leaf are generated. If camera moves in a way it leaves both the leaf and it's parent, stars for both (the new leaf and it's parent) are generated.
Generation of stars alone is then simple calling of random function. First value returned by random function is used as a count of stars in the sector. For each star is then given random X-Y-Z coordinates within the limits of the sector, a size, a color, etc.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!