meirbon / rtbvh

BVH library for Rust
Apache License 2.0
17 stars 0 forks source link

Intersections randomly fail in (at least) the standard BVH-implementation #4

Open RickyvdW opened 3 years ago

RickyvdW commented 3 years ago

Issue:

In the environment depicted below, intersection checks (from every origin, in every direction) fail for the two large triangles using the standard BVH implementation. When stepping through the BVH iterator sequentially, the primitives which contain these two triangles are (sometimes) not reached.

I've set up an MRE which constructs a BVH of the 4 triangles in the environment below and then performs intersection checks downwards from positions above the triangles' centers. These intersections should in theory never fail, but they do. The problem occurs non-deterministically, which leads me to believe there is a small bug in the BVH construction step or in the BVH iterator.

Notes:

MRE with failing intersections

How to reproduce:

  1. Download the MRE: rtbvh-mre.zip.
  2. Run the included test using cargo test -- --nocapture. The test will run for 10 iterations.
  3. Observe the intersection assertion failing at a random iteration of the test.