2
$\begingroup$

I'm reading about BVH from PBRT. According to the book, in the linear bvh part using morton encoding:

An efficient way to perform a front-to-back traversal without incurring the expense of intersecting the ray with both child nodes and comparing the distances is to use the sign of the ray’s direction vector for the coordinate axis along which primitives were partitioned for the current node: if the sign is negative, we should visit the second child before the first child, since the primitives that went into the second child’s subtree were on the upper side of the partition point. (And conversely for a positive-signed direction.)

I'm unable to understand how the sign of the ray's direction vector helps in deciding which child to visit. If the partitioning axis is x, doesn't the point with a lower x come in the 1st child? Or have I understood something wrong?

$\endgroup$
1
$\begingroup$

In your example of a BVH cell partitioned along the x axis, if the ray is going left to right (increasing x), then the cell with the lower x comes first; but if it's going right to left (decreasing x), then the cell with the higher x comes first. So, you can look at the sign of the x component of the direction vector to determine which cell to test first.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.