Builtin Library
- ..
- README.md1.0 KB
- bindings.yaml2.0 KB
- shader.wgsl1.1 KB
README.md
bvh
The tree of a bounding volume hierarchy over the primitives of a geometry (an
LBVH): a leaf per primitive in Morton order with its bounds, and the internal
nodes linked by the longest common prefix of the sorted codes, equal codes broken
by place. It reads the points (pts), the point each vertex reads (vpt), each
primitive's vstart and vcount, the codes of bvh_codes and the order the
sort kernel gives them, over the params np (the primitives) and pyr_size
(np rounded up to a power of two). It writes every leaf and every link of
nodes ((2 * np - 1) * 8 words) and allocates pyr (6 * pyr_size words),
the pyramid bvh_pyramid fills. bvh_pyramid and bvh_internal then fill in
the internal bounds, and the ray and intersect_pairs kernels traverse the
finished table. The geometry.bvh node runs the whole build and answers the
table as its tree. bindings.yaml states the node layout and the order the
kernels run in. Dispatch over np. Exact: the same geometry gives the same tree.