Fermat
|
GPU-based SAH BVH builder.
GPU-based SAH BVH builder.
This builders provides the context to generate a bounding volume hierarchy using the Surface Area Heuristic out of a generic set of unsorted bounding boxes. The output is a set of nodes with the corresponding leaves and a set of primitive indices into the input set of points. The output leaves will specify contiguous ranges into this index.
The following code snippet shows how to use this builder:
#include <sah_builder.h>
Classes | |
struct | Bbox |
struct | Bin |
struct | Bins |
struct | Objects |
struct | Queue |
struct | Split |
Public Methods | |
Sah_builder (thrust::device_vector< Bvh_node > &nodes, thrust::device_vector< uint2 > &leaves, thrust::device_vector< uint32 > &index) | |
constructor | |
template<typename Iterator > | |
void | build (const uint32 BINS, const Bbox3f bbox, const Iterator bbox_begin, const Iterator bbox_end, const uint32 max_leaf_size, const float max_cost=1.8f) |
build a bvh given a set of bboxes | |
Sah_builder (thrust::device_vector< Bvh_node > &nodes, thrust::device_vector< uint2 > &leaves, thrust::device_vector< uint32 > &index) | |
template<typename Iterator > | |
void | build (const Bbox3f bbox, const Iterator bbox_begin, const Iterator bbox_end, const uint32 max_leaf_size, const float max_cost=1.8f) |
Public Members | |
thrust::device_vector< Bvh_node > * | m_nodes |
thrust::device_vector< uint2 > * | m_leaves |
thrust::device_vector< uint32 > * | m_index |
uint32 | m_levels [128] |
uint32 | m_level_count |
Bbox3f | m_bbox |
uint32 | m_node_count |
uint32 | m_leaf_count |
float | m_init_bins_time |
float | m_update_bins_time |
float | m_sah_split_time |
float | m_distribute_objects_time |
thrust::device_vector< float3 > | m_bin_bmin |
thrust::device_vector< float3 > | m_bin_bmax |
thrust::device_vector< int32 > | m_bin_size |
thrust::device_vector< Bin > | m_queue_bins |
thrust::device_vector< Split > | m_queue_splits |
thrust::device_vector< uint32 > | m_queue_offsets |
thrust::device_vector< int4 > | m_bin_ids |
thrust::device_vector< int32 > | m_split_ids |
thrust::device_vector< int32 > | m_node_ids |
thrust::device_vector< uint32 > | m_new_pos |
thrust::device_vector< uint32 > | m_counters |
float | m_sorting_time |
float | m_compression_time |
uint32 | m_temp_storage |
|
inline |
constructor
nodes | output nodes array |
leaves | output leaf array |
index | output index array |
void nih::cuda::Sah_builder::build | ( | const Bbox3f | bbox, |
const Iterator | bbox_begin, | ||
const Iterator | bbox_end, | ||
const uint32 | max_leaf_size, | ||
const float | max_cost = 1.8f |
||
) |
build a bvh given a set of bboxes. The bbox iterators must be thrust-compatible (i.e. implementing dereference()).
bbox | global bbox |
bbox_begin | beginning of the bbox sequence |
bbox_end | end of the bbox sequence |
max_leaf_size | maximum leaf size |
max_cost | maximum cost relative to the parent |