2010年6月28日 星期一

[Progress]BVH with AABB

I finished two version of BVH, but they're mostly the same.
Here is the basic program flow:

For each BVH node (including the root)
Initial the BVH node (find max and min corner)
Sort with three axises and find the best gap to separate into two child nodes.
(using surface area to find the best event)

If I set the initial cost value to infinity then all leaf node will contain only one element.
But if I set it as a value that evaluate by the ray-box intersection cost and ray-triangle intersection cost, then the leaf node might contain more than one element, but however, if your parameters are correct, it might have better performance.

For SSE implementation, the BVH node "MUST" be 4-element leaf or the performance will be compromised. So I also implement a version that every node (except the leftmost or rightmost one for the case that the number is not multiple of 4) contains exactly 4 elements. It's not hard to implement but must be careful considering both two situations (put the remains in the left or right.)

沒有留言:

張貼留言