1.3.72
 
Loading...
Searching...
No Matches
helios::BVHBuilder Class Reference

BVH builder using SAH (Surface Area Heuristic) More...

#include <BVHBuilder.h>

Public Member Functions

std::vector< BVHNodebuild (const RayTracingGeometry &geometry)
 Build BVH from geometry.
 
const std::vector< uint32_t > & getPrimitiveIndices () const
 Get primitive indices for leaves (ordered by tree structure)
 
std::vector< CWBVH_NodeconvertToCWBVH (const std::vector< BVHNode > &bvh2_nodes)
 Convert BVH2 to CWBVH (Compressed Wide BVH)
 

Detailed Description

BVH builder using SAH (Surface Area Heuristic)

Constructs a high-quality BVH on CPU using:

  • Top-down recursive SAH split (16-bin binned SAH)
  • Type-homogeneous leaves (each leaf contains one primitive type)
  • Flat array output for GPU traversal

Definition at line 140 of file BVHBuilder.h.

Member Function Documentation

◆ build()

std::vector< BVHNode > helios::BVHBuilder::build ( const RayTracingGeometry geometry)

Build BVH from geometry.

Parameters
[in]geometryGeometry data (all primitive types)
Returns
Flat array of BVH nodes ready for GPU upload

Steps:

  1. Compute per-primitive AABBs (TBB parallel)
  2. Build BVH tree (top-down recursive SAH)
  3. Flatten tree to contiguous array (DFS order)

Definition at line 24 of file BVHBuilder.cpp.

◆ convertToCWBVH()

std::vector< CWBVH_Node > helios::BVHBuilder::convertToCWBVH ( const std::vector< BVHNode > &  bvh2_nodes)

Convert BVH2 to CWBVH (Compressed Wide BVH)

Parameters
bvh2_nodesFlat BVH2 array from build()
Returns
CWBVH nodes (80 bytes each, 8-wide with quantized AABBs)

Conversion process:

  1. Reconstruct tree from flat BVH2
  2. Collapse BVH2 → BVH8 (greedy top-down)
  3. Assign children to octants (Morton ordering)
  4. Quantize AABBs to 8-bit
  5. Flatten to contiguous array

Expected performance: 1.6-2.1x faster traversal for incoherent rays

Definition at line 470 of file BVHBuilder.cpp.

◆ getPrimitiveIndices()

const std::vector< uint32_t > & helios::BVHBuilder::getPrimitiveIndices ( ) const
inline

Get primitive indices for leaves (ordered by tree structure)

Returns
Primitive indices in BVH leaf order

Used to reorder geometry data to match BVH leaf layout. Each leaf's primitives are contiguous in this array.

Definition at line 163 of file BVHBuilder.h.


The documentation for this class was generated from the following files: