Page 1 of 1

Celestia octree

Posted: 18.01.2003, 03:08
by Mark Shaxted
Hi

I'm writing some software which involves large numbers of stars (at least a million) - much in the way that celestia does.

I'm now at the point where I need to create an efficient octree to store all this star data, and I was hoping you're knowledge of the subject could save me some time here.

I have two basic questions:

1 - What rules do you apply when storing a star in a given node? I know it's a combination of position and abs magnitude - but what actual numbers do you use?

2 - How many levels of recursion are required from the root node to the deepest nodes? And is this depth pre-determined, or do you just keep recursing until a certain criteria is met?

Regards

Mark Shaxted

An after-thought ...

Posted: 18.01.2003, 03:12
by Mark Shaxted
Another quicky ... :wink:

Does anyone know how many stars are visible in celestia from our solar system using limiting visual magnitudes of 6, 6.5, 7, 7.5 and 8?

Cheers!

Celestia octree

Posted: 18.01.2003, 03:48
by chris
Mark Shaxted wrote:Hi

I'm writing some software which involves large numbers of stars (at least a million) - much in the way that celestia does.

I'm now at the point where I need to create an efficient octree to store all this star data, and I was hoping you're knowledge of the subject could save me some time here.

I have two basic questions:

1 - What rules do you apply when storing a star in a given node? I know it's a combination of position and abs magnitude - but what actual numbers do you use?

2 - How many levels of recursion are required from the root node to the deepest nodes? And is this depth pre-determined, or do you just keep recursing until a certain criteria is met?

There's no fixed depth limit . . . The way it works is that brighter stars go into nodes closer to the root. At the beginning, I start with just the root node. I keep adding stars to that node until a threshhold (I currently use 100) is reached. At that point, the node is split into 8 subnodes. Stars brighter than a certain absolute magnitude remain in the main node, dimmer ones get placed in subnodes, the particular ones depending upon the stars' positions. The absolute magnitude threshold is fainter for deeper in the octree. At the top node, it's something like -6.0, but you can tweak this based on the size of the root node. The scale factor between levels is a luminosity scale of 1/4 (since light attenuates with 1/r^2, a star that's 1/4 as bright remains visible half as far away, and the side of an octree subnode is half that of its parent's)

When traversing the octree to display the stars, remember that for maximum efficiency, you need to do a view frustum cull as well as magnitude culling.

If your project is open source, feel free to just use Celestia's octree class and save yourself the hassle of implementing and debugging it yourself. The octree (in src/celengine/octree.cpp if you haven't already found it) is one of the cleaner and better documented pieces of the Celestia code base.

--Chris