Skip to main content
GameDev.net gamedev.net
🔒 Locked

Octree question

Started by IndyJones Jul 20, 2003 at 5:12 PM 2 replies 550+ views
Original Post
IndyJones
IndyJones
Hi! I''ve the following question: What is the better way of implementing an octree for outdoor (focused) and indoor levels concerning polys that span over several leafs? Is it better to align the boxes at this polys or would it be better to split it? I think the first approach could bring some trouble in indoor levels that contain large polygons ... thx!
y2kiah
y2kiah
I''ve always been a big fan of loose octtrees (or aligning the boundries to the polygons). Splitting a polygon does not seem like a clean solution to this problem to me, just my 2 cents.
nickwinters
nickwinters
So are octrees/quadtrees supposed to keep track of vertices, or polygons?

And if they just keep track of the graphics, how about the object they represent? How is that data stored?

Thanks.

-Nick
y2kiah
y2kiah
you can really use a quadtree or octtree for whatever you want, its main purpose is spacial subdivision. They give you a quick way to cull large amounts of your world away, and don''t have to operate on any specific data form. For instance my terrain quadtree includes 2 bounding boxes for each node. One bounding box is for the terrain, and stores an index into an array of vertex data. When the traversal reaches the leaf node, the engine draws the whole leaf as a triangle strip (actually many triangle strips since I use splatting).

The second bounding box is fitted to hold all of the bounding spheres of the STATIC objects whose center point lies within the first bounding box. I choose bounding speheres because they are set up to allow the object to animate and rotate without breaching the bounds of the sphere, where a box would have to be recalculated. The objects are static if they are not allowed to move. So with the second bounding box you get very fast culling of static world objects. This bbox may very well be much bigger or much smaller than the terrain box depending on the size of the objects that are within it, and the box operates on whole objects, not polygons.

So these are two examples of using a quadtree to operate on different kinds of data. The best thing you can do is be creative with your implementation to suit your needs.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.