8-Wide BVH

This is a fast, vectorized implementation of a SAH-based 8-wide BVH, targetting hybrid (ray- and cone-tracing) workloads. Several optimizations that target cone tracing are implemented [Emre et al., 2025].


class bvh8w_t : public wt::ads::ads_t

Public Types

using node_t = bvh8w::node_t
using leaf_node_t = bvh8w::leaf_node_t

Public Functions

inline bvh8w_t(std::vector<node_t> nodes, std::vector<leaf_node_t> leaf_nodes, tris_vectorized_data_t vectorized_data, std::vector<tri_t> tris, const aabb_t &world, f_t sah_cost, f_t occupancy, std::size_t max_depth) noexcept
inline virtual std::size_t nodes_count() const noexcept override
inline const auto &vectorized_tri_data() const noexcept
inline const std::int32_t root_ptr() const noexcept
inline const node_t &node(idx_t nidx) const noexcept
inline const leaf_node_t &leaf_node(idx_t nidx) const noexcept
inline virtual const aabb_t &V() const noexcept override
virtual intersection_record_t intersect(const ball_t &ball, const intersect_opts_t &opts = intersect_opts_t::defaults()) const noexcept override

Intersects the ADS with ball, returning the intersection record and contained primitives.

virtual intersection_record_t intersect(const ray_t &ray, const pqrange_t<> range = {0 * u::m, limits<length_t>::infinity()}) const noexcept override

Intersects the ADS with a ray, returning the intersection record with the intersected primitive.

Parameters:
  • range – traversal bounds

  • z_search_range_scale – scaler for z-axis search range

virtual intersection_record_t intersect(const elliptic_cone_t &cone, const pqrange_t<> range = {0 * u::m, limits<length_t>::infinity()}, const intersect_opts_t &opts = intersect_opts_t::defaults()) const noexcept override

Intersects the ADS with a cone, returning the intersection record and contained primitives. Once the closest intersection is found, looks for triangles within a z distance from the closest point. This distance is computed as the cone major axis length time ‘z_search_range_scale’.

Parameters:
  • range – traversal bounds

  • z_search_range_scale – scaler for z-axis search range

virtual bool shadow(const ray_t &ray, const pqrange_t<> range) const noexcept override

Intersects the ADS with a ray. Returns TRUE if a hit was found.

Parameters:
  • traversal_mode – traversal mode (front/back/font-and-back faces)

  • range – traversal bounds

virtual bool shadow(const elliptic_cone_t &cone, const pqrange_t<> range) const noexcept override

Intersects the ADS with a cone. Returns TRUE if a hit was found.

Parameters:

range – traversal bounds

virtual scene::element::info_t description() const override

Friends

friend class construction::bvh8w_constructor_t
struct tris_vectorized_data_t

Public Members

std::vector<length_t> ax
std::vector<length_t> ay
std::vector<length_t> az
std::vector<length_t> bx
std::vector<length_t> by
std::vector<length_t> bz
std::vector<length_t> cx
std::vector<length_t> cy
std::vector<length_t> cz
std::vector<f_t> nx
std::vector<f_t> ny
std::vector<f_t> nz

class bvh8w_constructor_t : public wt::ads::construction::ads_constructor_t

Constructs an 8-wide SAH BVH.

Public Functions

bvh8w_constructor_t(std::vector<std::shared_ptr<shape_t>> objs, const wt::wt_context_t &context, std::optional<progress_callback_t> progress_callbacks = {})
inline virtual std::unique_ptr<ads_t> get() && override