Builtin Library
- ..
- README.md675 B
- bindings.yaml1.2 KB
- shader.wgsl947 B
README.md
bvh_codes
A 30-bit Morton code for each primitive of a geometry: its bounds centre,
normalized inside the scene bounds and interleaved bit by bit. Sorting
primitives by this code puts primitives that are near in space near in the
order, which is what the bvh kernel builds its tree from. It reads the points
(pts), the point each vertex reads (vpt), each primitive's vstart and
vcount, and the scene bounds lo and hi (xyz each: a min and a max reduce
of the points), and writes codes, one word per primitive, 0 for a primitive
with no vertices. The geometry.bvh node runs it, sorts the codes and hands
both to bvh. Dispatch over the primitives. Exact.