Lagrange
Loading...
Searching...
No Matches
OccludedFacetSampler< Scalar, Index >::Impl Struct Reference
Inheritance diagram for OccludedFacetSampler< Scalar, Index >::Impl:
ImplBase< Derived, Scalar, Index >

Classes

struct  AdaptiveCandidate
 Seed for an Adaptive ray cast: a visible neighbor and its cached escape direction. More...
 

Public Types

using InstanceInfo = typename OccludedFacetSampler<Scalar, Index>::InstanceInfo
 

Public Member Functions

 Impl (uint64_t total_facets)
 
Scalar instance_active_weight (size_t i) const
 
template<typename Vertices, typename Facets>
void process_instance (size_t i, uint64_t instance_rays, Scalar instance_weight, const Vertices &vertices, const Facets &facets)
 
void end_batch ()
 
 OccludedFacetSampler (const scene::SimpleScene< Scalar, Index, 3 > &scene, const OccludedFacetSamplerOptions &options={}, function_ref< bool(Index mesh_index, Index instance_index)> is_occluder=[](Index, Index) { return true;})
 Build the ray caster and per-instance world-space facet data.
 
 OccludedFacetSampler (OccludedFacetSampler &&) noexcept
 
OccludedFacetSampleroperator= (OccludedFacetSampler &&) noexcept
 
void run_normal_batch (uint64_t num_rays)
 Cosine-weighted hemisphere batch.
 
void run_adaptive_batch (uint64_t num_rays)
 Adaptive batch using cached escape directions of 1-ring visible neighbors.
 
void run_brute_force_batch (uint64_t num_rays)
 Cosine-weighted hemisphere batch with no escape caching — baseline for benchmarking the adaptive mode against pure sampling.
 
bool is_visible (uint64_t global_facet_index) const
 Whether the facet has been marked visible so far.
 
uint64_t num_rays_cast (uint64_t global_facet_index) const
 Rays cast so far for the facet.
 
uint64_t num_facets () const
 Total number of facets across all instances.
 
span< const InstanceInfo > instances () const
 Per-instance metadata for mapping global facet indices to (mesh, instance, local facet).
 
- Public Member Functions inherited from ImplBase< Derived, Scalar, Index >
Derived & derived ()
 
const Derived & derived () const
 
size_t num_instances () const
 
Index mesh_index (size_t i) const
 
const auto & instance_transform (size_t i) const
 
Scalar compute_total_active_weight () const
 
void run_batch (uint64_t num_rays)
 

Public Attributes

std::vector< FacetInstanceData< Scalar, Index > > m_instances
 
std::vector< InstanceInfo > m_instance_infos
 
std::vector< uint8_t > m_num_escaped_rays_per_facet
 Cumulative escape tally across completed batches; visible iff value >= threshold.
 
std::vector< uint8_t > m_staging_escaped_rays_per_facet
 Per-batch staging.
 
std::vector< uint64_t > m_num_rays_cast
 
Scalar m_jitter_sigma
 
uint8_t m_visibility_threshold
 
SamplingMode m_current_mode = SamplingMode::Normal
 
std::vector< Scalarm_instance_active_weights
 Sum of facet_weights[lf] over each instance's active facets; refreshed in end_batch().
 
tbb::enumerable_thread_specific< std::vector< AdaptiveCandidate > > m_tls_candidates
 Per-thread scratch for Adaptive candidates; reused across batches to avoid realloc.
 
- Public Attributes inherited from ImplBase< Derived, Scalar, Index >
scene::SimpleScene< Scalar, Index, 3 > m_scene
 
RayCaster m_ray_caster
 

Member Function Documentation

◆ OccludedFacetSampler()

OccludedFacetSampler ( const scene::SimpleScene< Scalar, Index, 3 > & scene,
const OccludedFacetSamplerOptions & options = {},
function_ref< bool(Index mesh_index, Index instance_index)> is_occluder = [](Index, Index) { return true; } )
explicit

Build the ray caster and per-instance world-space facet data.

Parameters
[in]sceneScene to process. Every referenced mesh must be a triangle mesh.
[in]optionsSampler options.
[in]is_occluderReturns whether (mesh_index, instance_index) should block rays. Non-occluder instances are still tested for visibility but do not contribute to the ray-caster scene.

◆ run_normal_batch()

void run_normal_batch ( uint64_t num_rays)

Cosine-weighted hemisphere batch.

Caches each facet's first-discovered escape direction for later adaptive batches.

◆ run_adaptive_batch()

void run_adaptive_batch ( uint64_t num_rays)

Adaptive batch using cached escape directions of 1-ring visible neighbors.

Skips facets with no visible neighbor.

◆ num_facets()

uint64_t num_facets ( ) const

Total number of facets across all instances.

Multi-instance meshes are counted once per instance.

Member Data Documentation

◆ m_num_escaped_rays_per_facet

template<typename Scalar, typename Index>
std::vector<uint8_t> m_num_escaped_rays_per_facet

Cumulative escape tally across completed batches; visible iff value >= threshold.

Saturates at 255.

◆ m_staging_escaped_rays_per_facet

template<typename Scalar, typename Index>
std::vector<uint8_t> m_staging_escaped_rays_per_facet

Per-batch staging.

Each chunk owns its facets exclusively so writes don't race. Merged into m_num_escaped_rays_per_facet in end_batch().


The documentation for this struct was generated from the following file: