octree Culling

Started by
1 comment, last by Blackdragon666 21 years, 8 months ago
Hello, I am trying to add octrees to my height map terrain render. I have the heightmap working correctly but i cant figure out how to break up the the terrain into an octree. Im using DirectX and c++. The Way that the terrain is stored right now if just 1 large Vertex buffer. I have no textures yet, cause i want to have the octree culling working first. I cant find any tutorials on the subject, If anyone can point me to some information on the subject that would be great. Thanks Blackdragon
Advertisement
Don''t use 1 big VB... Use smaller chunks. Like 8 by 8 squares. Then paste them together.

Then its easier. You make a bounding box around the 8 by 8 square of the map, then do a visibility check on it... If its in the frustrum, draw it... If its not, discard it.

The actual tree portion is you go recursively. Check the 8 by 8 section of the map, if its visible, instead of draw it, you go down the tree, now check inside that 8x8 section and check to see if this 4x4 section is visible, if so, go down the tree again and look up the 2x2 section.

If the landscape is big (and bland, not alot of detail) its actually faster to eliminate the tree, and just do checks on the 8 by 8 and thats it.
There is enough information on the net about octrees.
My prefered are :
- www.GameTutorials.com
- www.Flipcode.com
- www.Gamasutra.com -> You must sign up (free)

The basic structure is simple. First of all you need to construct a bounding volume (an axis aligned box ) that contains all your geometry, and then subdivide it into 8 octants
(eight smaller cubes). Continue the subdivision of each octant recursively until certain heuristics are met (ex: a minimal polygon count inside a child cube is reached, a maximum number of nodes are created,...)

The explanation of the structure are well explained in the sites above.
If you don''t find the solution you wanted you always have books like Game Programming Gems or Realtime Rendering.

Hope I was of any help 9:-|

This topic is closed to new replies.

Advertisement