Creating a procedural galaxy viewer

I watched this video and it inspired me to achieve something amazing like this:

http://www.youtube.com/watch?v=P0-lsyo28SU



Now, I have been thinking about how to implement something like this.



Using SharedMeshes it is pushing JME to have 50,000 quad objects, so…



I have thought out the idea of using something akin to a octree for breaking down the galaxy and only rendering what needs to be rendered, however, that is not the problem.



The problem is, when you zoom out and are not utilizing cubes in the octree, how do you get them to continue rendering these points in the way that Infinity does it?



Notice in the video, when he is zoomed all the way out, points still exist to represent this galaxy. when zoomed all the way out you see countless stars, well over 50,000. So, how would one accomplish rendering so much with JME?



My current idea is to use geometry instancing for the far away stuff ( i got 90,000 quads to render with 30 FPS ) and they could be incorporated into the octree design, where the octree cubes not rendering stars are actually rendering geometry instancing stars, and the farther away the cube is, (utilizing DLOD) can render less objects to help save on FPS.



That means, when the player is all the way zoomed out, it will be rendering the octree in a 3x3x3 with the DLOD rendering the least amount of white star points.



Again, rendering the individual stars when close to them is not the problem.

I am mainly concerned for how to manage this large amount of data.

Thank you very much for any help :slight_smile:

Once you generate the stars in the entire galaxy, you put them in an octree and generate a batch for each octree leaf. You can either use point sprites (GL2) or geometry shader (GL3) to generate the quad for every star.

There are further optimizations possible by generating several levels of detail for the leafs so when you move far away for example it won't render the smaller stars thus improving fps.



This is kind of a fun and easy project to do for the most part, but I don't think it's that practical, at least not for games.

A couple of update:


  1. I think i am going to use something similar to the stardust class, except points will be placed upon a probability derived from a greyscale texture of the milkyway galaxy.



    Now… if only i knew how to do lookups in texture coordinates in JME :stuck_out_tongue:



    Also, I think the biggest problem will be this:



    while points are efficient and such, they are not pickable. This will be a major problem for me as i cannot shoot a ray and test for intersection. Is there any way to efficiently pick a Point from a pool of countless points?

Well since you put the points there you should know where they are and thus know which point the mousepick ray is hitting right? I have this for stars that I put on a r=1 sphere as skybox.

Hi,

The creator of infinity has a blog on gamedev: http://www.gamedev.net/community/forums/mod/journal/journal.asp?jn=263350

He described some parts of the engine there.



Have fun,

Snare

Fun scene partitioning anyone?



( i know the program says its called octree but its actually just a quad tree)


Yeah just put the points in the octree and then check the ray against that. Once you find a leaf just go through each point and check it as if it were a sphere against the ray.

First screenshot from my galaxy generation



The greyscale picture of the galaxy was used to derive the locations, however, each star has its information saved in 2 of 8 files which holds the galaxy information (1 for vectors and 1 for colors) however i will be making colors more efficient.



So, the beauty of this is that I can continually load the same galaxy over and over which makes it perfect for a game.



(btw this galaxy has a little over 77k stars in it)