I am using the SAH-BVH from PBRT-v3, it works fine for triangle-mesh, especially for dense mesh.

But here is a problem. If I added Cornell box while building the BVH tree, the BVH performance will drop to only 20% as before. The Cornell box is only 6 rectangles. Why does it behave in this way? Because it's a big box containing everything? How to improve it?

  • $\begingroup$ How do you measure that performance drop exactly? There are many possible explanations and knowing this would help narrow it down to the more likely ones. $\endgroup$
    – Olivier
    Sep 3, 2020 at 15:09
  • $\begingroup$ I am doing GPU ray tracing in shader. It will drop from 50+fps to 10-fps. @Olivier $\endgroup$
    – iaomw
    Sep 3, 2020 at 15:44
  • $\begingroup$ Does your screen go from mostly empty without the box to being filled by a cornell box? Or is the difference there no matter how you place the camera? Are you rendering only primary rays or some number of bounces? $\endgroup$
    – Olivier
    Sep 4, 2020 at 14:42
  • $\begingroup$ The mesh takes 50% screen, the box will take 80% maybe. Yeah, it has max 32 bouncing number. @Olivier $\endgroup$
    – iaomw
    Sep 4, 2020 at 15:55
  • $\begingroup$ How big are the triangles of the box's walls? If you subdivide them 2 or 3 times, you'll notice an increase in performance but still not upto the original level. The walls will almost always lower the performance of the bvh as they are more a form of a container. You'll get faster performance by checking 12 triangles (assuming 2 per wall) separately instead of dumping them inside a bvh. $\endgroup$ Sep 5, 2020 at 16:03


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.