# Octree Questions

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

## Recommended Posts

Hello, I have several question regarding to octree: 1. What do i have to store in an octree node: Meshes, Triangles, or Vertices? Currently i am storing vertices but i think its not correct, because if i am going to cull vertices i have to alter triangles to not get weird results. 2. if i have a flat mesh (e.g floor) how do i have to calculate octree maxY position? i did sth like that but don't know if it is correct:
if(maxY == minY) {

maxY = (maxX + maxZ) / 2; //because it has to be cube, right?

}

3. When do i have to stop creating children? is it some static value which is applied for all octrees or its a values that depends on the bounds of the root octree? 4. Can i cull objects using octree and geometry shaders? Thanks, Kasya

##### Share on other sites
Just a quickie as I'm busy here at work :)

1. Triangles
2. Not sure I understand this one? You calculate the bounding box for a 3D mesh object. So if it's flat the bounding box calculation will sort it out right?
3. You just determine a certain triangle count. So when a node contains less than this count, you stop the subdividing.
4. Octrees are great for both culling and collision detection. Adding occlusion is recommended for very dense scenes.

##### Share on other sites
Quote:
 Original post by Kasya1. What do i have to store in an octree node: Meshes, Triangles, or Vertices? Currently i am storing vertices but i think its not correct, because if i am going to cull vertices i have to alter triangles to not get weird results.

Depends on what you want to use the octree for, but in this case, for visual culling, storing meshes will likely be better. You can always do further culling on the triangle-level for those particularly highly detailed meshes. Storing vertices, as you noticed, would be impractical for this purpose.

Quote:
 2. if i have a flat mesh (e.g floor) how do i have to calculate octree maxY position?

The same as you would do with any other object. You simply get a box with a height of 0. No problem with that. And no, you don't need cubes - AABBs of any size will work. Octree nodes just happen to be cubes in most octree implementations, but that's just coincidence.

Quote:
 3. When do i have to stop creating children? is it some static value which is applied for all octrees or its a values that depends on the bounds of the root octree?

Depends on what you want. You could give each octree node a limit, and make it create child nodes when it contains too many objects, or you could manually create a pre-defined number of levels and just go with that. Ultimately, you have control over your octree implementation. There are many possible variations, go with what works best for your situation.

Quote:
 4. Can i cull objects using octree and geometry shaders?

I am not familiar with geometry shaders, but it seems odd to do the culling at that level. Why send things to the graphics card only to cull them there? Culling on the CPU works as well and saves you some GPU bandwidth.

##### Share on other sites
Thanks for your help! Now getting to work :)

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633654
• Total Posts
3013168
×