# Octree Questions

This topic is 3369 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi. I'm not really having a problem implementing anything, I just have a few questions about Octrees, and a few conceptual techniques to be used in cooperation with them. First, let me explain my situation: I'm using this Octree in a simple way. The player is free to fly around throughout the map. The map is generated mathematically, and I'm not really doing collisions yet...The map is composed of small, self-contained, non-complex objects which I can simply use as points instead of triangles in this Octree. What I'm trying to do with this Octree is divide it around the player until the max depth is hit, and nodes with a shallower depth generate less objects in more volume (Because they are further away), and more objects are generated near the player, in deeper nodes. This is simply a way of optimising rendering, really. There are supposed to be a ton of these objects, and far-away ones should not be shown. My questions have to do with the player. I have a function that can split the Octree all the way down to a point, so the lowest depth contains the point, but I don't think that's how it should be done - I'd like to do it based on the distance from the centers of nodes to the player. I can accomplish this much, but how are you supposed to re-evaluate the Octree when the player leaves his node bounding box? Surely, there's a way to shift around a few nodes in memory based on the movement made, rather than re-doing the WHOLE thing based on his new position...The max depth is going to be somewhere between 8 and 14, and redoing the whole thing could lag. Maybe I'm overestimating the time it will take? EDIT: And I forgot to mention that whenever nodes are merged, the object list is cleared, and they are re-generated, so redoing the entire scene is probably out of the question. I need a way to figure out the lowest common parent of the two nodes the player travelled to/from, and evaluate only that node again. My next question: Let's say I have a set number of these objects that can be generated in total, fully split to the max depth for all nodes. Is there a way to regulate the number of objects a node of n depth contains, so that the sum of all depths is equal to this max value? EDIT: Here's the problem I face, with a diagram. When the player happens to be near the intersections of large parents, the larger parents only generate objects that are large, and then only a few of them, because they are less important. That part is supposed to happen, but not when the player is close to a border like that. I want to be able to detect this problem, and split the nearby nodes further, even though the player isn't in them. Furthermore, I want an efficient way of re-evaluating the whole process (merging and splitting nodes) when you cross nodes, without redoing the whole tree. http://omniserver.dynalias.com/Uploads/OctreeProblem.jpg Larger objects are put in larger nodes, smaller objects in smaller nodes. [Edited by - Omniscience on November 2, 2009 8:35:28 AM]

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
634131
• Total Posts
3015729
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!