Jump to content
  • Advertisement
Sign in to follow this  

Unity Conceptual question regarding universe simulator - Unity3D

This topic is 949 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all. I am currently working on a project, a universe star simulator. I have a dataset of 100,000 stars. In order to deal with the massive scale of the universe I have decided to go with the design of having two co-ordinates systems. One will represent all close proximity stars (these will be loaded as high detail 3D models) and the Second will represent all distant stars within the users fov (These will be drawn at the main cameras farplane).


Currently I have my dataset stored within an Octree and I can successfully fetch all points contained within a specified frustum.


The design I was thinking of going with was having two cameras within my scene, each representing a co-ordinate system. I would have a variable that I can grow/shrink that would be the conversion rate between the two co-ord systems. I would divide the larger scale by the conversion factor to get to the lower scale. 


Question: Would I have my camera2 (distant stars) frustum grow by the conversion rate -> fetch all points within the larger frustum -> generate mesh with these fetched points (this mesh would represent the stars in world space?) and then convert(?) the mesh to projection view using the conversion rate as the translation component? Once I have this mesh I would pass it to be rendered. 


Or would it be better to dynamically grow the camera2 frustum collecting all containing stars ray cast from camera1 to each of these and draw the collision on camera1s farplane? How would I apply the conversionrate with this setup?


Im brand new to game development and unity so apologies if my questions or explanations dont make much sense, any help would be much appreciated!

Share this post

Link to post
Share on other sites





tl:dr  your data set is only 100 times the size of mine, you probably don't need octtree.  i find a simple flat array of structs to be plenty fast.   draw close stuff as a mesh, and far stuff as a pixel.  


just divide everything by your scale factor (i use 100,000,000 for the sun), and don't forget to lerp your mesh scale as you go from coliision rnage to max visual range (at which you just draw a pixel).

Share this post

Link to post
Share on other sites

Hey, this is what i learned so far based on my past experience and documentation:


    1. Use double precision

    2. Don't move the camera, move the world around the camera; you'll get most of the precision

        near the origin, so bringing the objects closer to origin is the way to go.

    3. Use a logarithmic depth buffer, it does wonders, really.

    4. Use a scale hierarchy starting from the parsec to the meter for instance.

        (pc, ly, au, km, m)

    5. Render the solar system with AU scale, when you get closer to a planet, use the KM scale, and when you land use the meter scale.


    When rendering solar systems, use realistic values and consider 1 unit being equal to 1 AU.

    Now, when you'll get inside the AU scale, in order to prevent the objects suddenly appear or pop larger,

    push the objects in the direction the camera is looking multiplied by the a scale vector.


    When the objects are far enough, simply draw them as pixels or don't draw them at all.

    I'd render the stars based on their brightness and distance on a cubemap then use the cubemap

    to render your skybox.


The rest should be pretty trivial i guess,  so good luck!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!