Octrees and how to use them

Started by
1 comment, last by ChristianFrantz 10 years, 6 months ago

In a previous thread I made I was told to look at different data structures for my game. As far as I can tell, using octrees seems to be the way to go for me.

http://www.xnawiki.com/index.php/Octree

Im using this as a base for my class. I know how they work and what their purpose is, I just don't know how to implement them into my game for things like occlusion culling and picking.

Right now I'm just going to have one octree for each 20x20x20 chunk. All my cubes will easily fit into one leaf so there's no hassle with more than one object in a leaf.

When I want to do something like occlusion culling, how would I start? Do I just check the nodes in the tree against other nodes?

If you see a post from me, you can safely assume its C# and XNA :)

Advertisement

I guess the basic idea of occlusion culling using trees is that if a tree node is occluded, any and all nodes descending from that node will be occluded as well.

So if you have an occluder that occludes lets say the root node of one of these 20^3 chunks, you can assume all objects inside are occluded too and be done with it.

Then you might in some cases want to traverse the scene close objects first, so you traverse the octree starting from the viewer (which seems somewhat complex)

So if you met a octree node that is fully solid when traversing, you would somehow be able to skip everything behind it, including other occluders, so you dont have to gather a huge list of occluders if there are many but only the occluders that are actually relevant and not covered by OTHER occluders.

o3o

Im just trying to occlude the individual blocks inside 1 chunk for right now. But I get what you're saying.

If you see a post from me, you can safely assume its C# and XNA :)

This topic is closed to new replies.

Advertisement