Loose octrees for frustum culling - Need some advice
I am implementing frustum culling for dynamic objects into my engine and have been reading as mush as I can about "loose octrees". Unfortunately most sources are quite vague and really it's just lots of posts of people saying how good they are and that they gave O(1) insertion and deletion but without explaining any of the logic behind it.
I understand the main principles that the octants are treated as being larger than they are and that the loose factor can go up to 2. This means that an object can be inserted into a single node based on it's size. The trouble is that alot of the articles don't use a "k-factor" of 2 (probably to get a tighter fit) and therefore lose the fast insertion/deletion; instead they maintain an adjacency structure so you can traverse all nodes at a given depth and test the centre of the object with each node.
I only need a rough开发者_Go百科 culling test and I'd like to have the O(1) insertion time and have worked out the formula for calculating the depth (level) that an object should be inserted. However I cannot find any articles that discuss a formula to calculate an exact node from the size and position of an object.
Have I totally misunderstood the algorithm and am I looking for something that isn't possible? If anyone can point me to any good papers or articles (I've read http://tulrich.com/geekstuff/) then that would be great.
PS It may be worth mentioning that I am using a linear octree stored in a 1D array
Thanks for any help
I got the answer on the gamedev forum. The equation I was looking for was actually really simple
int NodeIndex = depth*(bb.centre.x / sceneBB.width);
You didn't mean a multidimensional search in an octree? What about a space-filling-curve?
精彩评论