I want to use octree for object culling. My idea is as follows:
//called only once for objects at init time
Node** Octree::AddObject(AABB box, Node* parent)
if (IntersectAABBAABB(parent->box, box))
for (int i=0; i < 8; +++i)
if (IntersectAABBAABB(parent->Children[i]->box, box))
//update is called everyframe
if (IntersectAABBFrustum(parent->box, frustum)
parent->visible = true;
for (int i = 0; i < 8; ++i)
//move down the tree
//check for box against frustum
//set visible bool to true
// check it's children and do samething
//else if false, set its all children's visible bool to false without checking
parent->visible = false;
//set all children's visible bool to false without checking
//get node for this object
Node** houseNode = Octree.AddObject(house.box);
I need help, do you see any problems? what should I do when object is inbetween Node AABBs ?
Please give me suggestions/improvements for octree or any other data structure object culling.
I do my terrain culling in hull shader.
Also I got another problem as boxes are not in same space, I think transforming them to world space would result into wrong assumptions about object being in a particular node because AABB in world space does not tightly surround the object.
Edited by newtechnology, 18 April 2014 - 07:05 AM.