meirbon / rtbvh Goto Github PK
View Code? Open in Web Editor NEWBVH library for Rust
License: Apache License 2.0
BVH library for Rust
License: Apache License 2.0
Hey, I think this is a very interesting project! I maintain the bvh crate and I think it'd be super interesting to see a benchmark between this. I suppose yours will be many times faster but I'm very interested to see just how fast.
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:
cargo test -- --nocapture
. The test will run for 10 iterations.During MBVH construction the algorithm panics.
let bvh = (Builder {
aabbs: None,
primitives: triangles.as_slice(),
primitives_per_leaf: None,
})
.construct_binned_sah()
.unwrap_or_default();
let bvh = Mbvh::from(bvh);
thread 'main' panicked at 'Leaf nodes should not be attempted to be split!', C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\rtbvh-0.5.3\src\mbvh_node.rs:307:13
stack backtrace:
0: std::panicking::begin_panic<str>
at C:\Users\User\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs:519
1: rtbvh::mbvh_node::MbvhNode::merge_nodes
at C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\rtbvh-0.5.3\src\mbvh_node.rs:307
2: rtbvh::bvh::Mbvh::construct
at C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\rtbvh-0.5.3\src\bvh.rs:373
3: rtbvh::bvh::{{impl}}::from
at C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\rtbvh-0.5.3\src\bvh.rs:419
With the following input triangles.
128.79
-1422.82
0.16
128.5
-1426.88
0.16
128.79
-1426.9067
0.16
129.8
-1422.8629
0.16
128.79
-1422.82
0.16
128.79
-1426.9067
0.16
129.8
-1422.8629
0.16
128.79
-1426.9067
0.16
129.8
-1427
0.16
130.2
-1422.88
0.16
129.8
-1422.8629
0.16
129.8
-1427
0.16
130.2
-1422.88
0.16
129.8
-1427
0.16
130.2
-1423.13
0.16
This being 5 triangles composed of 3 points each composed of 3 components, so:
p0.x
p0.y
p0.z
p1.x
p1.y
p1.z
p2.x
p2.y
p2.z
And then repeat
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.