Archived

This topic is now archived and is closed to further replies.

eli_pulsifer

Octree / partitioning question

Recommended Posts

eli_pulsifer    122
Ok, I’ve decided to use an octree, but I would like to keep my models and polys in one piece. My problem is that when meshes cross octant boundaries, particularly high level ones ( first few subdivisions ) I either have to clip the objects, or deal with the fact that these objects will almost never be culled. Any suggestions on how to deal with this? I’ve thought of using some form of loose octree, but I’m not 100% sure how this works or if its a good solution.

Share this post


Link to post
Share on other sites
Dirge    300
Woah dude, you gotta decide on one thing first; Are you using an Octree to represent just Static models, or Dynamic ones, or both?

With Static Models you would just cut everything up either by actually splitting polys, or just storing which face is currently in the node (which creates overdraw, but there are techniques to combat this).

With Dynamic Models, you''re not splittin nothin in real-time. Well, I sure hope not (that would miss the point of this optimization)! For Dynamic Models, you just reinsert the Model, or more precisely, an Entity with a Bounding Cube (Box, Sphere, whatever) into the Octree every frame. It decides where to store it depending upon whether this bounding volume intersects the extents of an Octree Node, but all it has is a reference to that Entity (with the model). So now, when you call Octree->Render(), it just goes through the octree nodes (all of them), and checks how many entitys are in a node, if it''s not empty, render that model (or in a better case, ask the model to render itself).

Make sense? I''ll have some code on my site showing this method in a few weeks. Check it out later on: www.CodeFortress.com

Share this post


Link to post
Share on other sites
kill    146
For each object create an octree of its own, just partitioning that object. Then when you test the object against the octree recurse up the object octree and only render those nodes that you need.

With the newer cards you might actually loose speed that way because they will render all those extra polies much faster then you can traverse the octree of a small object, so you have to run tests to see if its worth it.

BTW, if you do collision detection and you need it to be precise, you''ll use octrees on objects too, so you''ll kill two birds with one stone.

Share this post


Link to post
Share on other sites