This is an excellent paper, I'll use it for my GPU tracer. One thing that I've noted, it seems the pseudo-code for BVH2 might lead to infinite loops for a novice implementer who might use the code as it is. I tested the code for a simple square plane which is made up of 2 triangles, meaning all nodes have same bounding box properties. This scenario will force the ray to intersect both leaf bounding boxes and do necessary intersection test, for a properly defined bvh (one node, 2 leaves i.e. 2n-1 property). As a result using the code in the paper, the ray traversal never enters the second leaf. Analysis of the code points to the problem of the leaf node code below.
Code: Select all
// Leaf node
if (!isInner(nodeId)) {
...
}
which should be
Code: Select all
// Leaf node
if (!isInner(nodeId)) {
// do necessary intersection first
...
// update parent and sibling status
parentId = nid.x;
siblingId = nid.y;
}
the above modified section of the leaf node code, resolved the issue. After a strenuous week of debugging. Lol
Has anyone encountered the similar problem?