Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

geometry.bvh

Build the bounding volume hierarchy over the primitives of a geometry on the device: one leaf a primitive in Morton order (codes over the geometry's bounds), internal nodes linked by the longest common prefix of the codes, every node holding the bounds of what lies under it. The tree is what ray queries traverse (geometry.boolean builds one over its second mesh). It is built over the primitives the geometry is allocated for; those past the live ones have no vertices, so their leaves are empty and no ray reaches them.

Inputs

  • geometry (Geometry). The geometry whose primitives are bounded.

Outputs

  • tree (Record). nodes (the node column the bvh kernels write, every node holding its bounds and its links) and count (the primitives it was built over).
local tree = g.geometry.bvh({ geometry = g.mesh.sphere({}) })