Octree sample code for XNA

 

In 3D world, many enthusiastic specialists and PhD are giving their life-time effort to rendering photorealistic objects like milk, skin, water, feather, shadow, etc. No doubt that it is good to have all these physical models about the rendering. When it comes to practical application, we, however, have to made a tradeoff between quality and performance and most of the time, the result yield at the later choice.

Demanding an application with excellent performance, we need to manage our scene wisely with some structures like BSP, Octree, Space partition index, and other similar techniques. Today I am going talk about Octree which has been using on out-door scene for decades.

According to the description of Wikipedia, An octree is a tree data structure in which each internal node has up to eight children. Octrees are most often used to partition a three dimensional space by recursively subdividing it into eight octants. Octrees are the three-dimensional analog of quadtrees. Octrees are employed in many out-door scene rendering since they can efficiently culling the invisible objects and they are easy to build and maintain.

In practice, we do not follow the strict rules ( as least, I don’t) made by the subdivision of octree. In the rule, each leaf of octree need to be fully occupied or fully empty, which means lots of processing time is consumed to fulfill. An alternative way of solving this can be setting up a maximum subdivision level, maximum numbers of geometries in the tree, maximum geometries in each tree node. By creating these limitation, an octree will be faster build and easier to update.

As I am digging in XNA these days, the sample project is in XGS 2.0 format.



posted on 2008-06-11 22:44  SigEric  阅读(1609)  评论(7编辑  收藏  举报

导航