public sealed class TriangleBvhA bounding-volume hierarchy over triangles — doc 19 § L6's reference half.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Why this exists before any RHI concept does. § L6 puts acceleration structures into the RHI as an alternative tracer behind L1's interface, and everything above it — the fillers, the gathers, the reflections — stays unchanged because a tracer answers with a hit, a distance and a normal whatever produced them. A hardware ray query cannot be checked against arithmetic; this can, and the day HasRayTracing stops being a declared-and-unimplemented flag, the query's answers are held against this build over the same triangles — the arrangement every capture and march in this engine has with its reference.
Median split over the longest axis, exactly. Not surface-area heuristic, and that is a choice about testability rather than ignorance of one: a median build is deterministic from the input order alone, two builds agree structurally, and the traversal's node count has a closed bound the tests can hold. SAH is a quality optimisation with this as its baseline and its referee, the shelf atlas's own argument.
The traversal answers the nearest hit, front-to-back. Children are visited near first, the far child is skipped when the ray already hit nearer — which is where the logarithm comes from — and Visited counts what it touched, so the claim is measured against the brute force rather than asserted.
Fields and properties (2)
public int TriangleCountHow many triangles the build holds.
public int NodeCountHow many nodes the hierarchy has.
Methods (3)
public TriangleBvh(ReadOnlySpan<Vector3> vertices, ReadOnlySpan<int> indices, int leafSize = 4)Builds a hierarchy over a triangle list.
public RayHit Trace(Vector3 origin, Vector3 direction, float maxDistance = Infinity)The nearest hit along a ray, or a miss.
public RayHit BruteForce(Vector3 origin, Vector3 direction, float maxDistance = Infinity)Every triangle, no hierarchy — the referee the traversal is held against.
Used by (3)
- QueriedFieldVixen.Rendering.RayTracing
- QueriedFieldTestsVixen.Rendering.RayTracing.Tests
- TriangleBvhTestsVixen.Rendering.RayTracing.Tests