|
Lagrange
|
Stateful algorithm for finding occluded facets across every instance of a scene. More...
#include <lagrange/raycasting/remove_occluded_facets.h>
Classes | |
| struct | Impl |
| struct | InstanceInfo |
| Maps a global facet index back to (mesh, instance, local facet). More... | |
Public Member Functions | |
| 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 | |
| OccludedFacetSampler & | operator= (OccludedFacetSampler &&) noexcept |
| void | run_batch (uint64_t num_rays) |
Trace one batch of num_rays rays, distributed across facets not yet decided. | |
| bool | is_visible (uint64_t global_facet_index) const |
Whether the facet is currently kept, i.e. visibility_measure >= threshold. | |
| double | visibility_measure (uint64_t global_facet_index) const |
The facet's visibility measure mean_visibility * (area_f / mean_face_area)^size_influence, where mean_visibility is the plain or MIS estimate of the cosine-weighted escaped fraction. | |
| 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. | |
| uint64_t | num_retired () const |
| Number of facets confidently above the keep threshold and retired from sampling. | |
| span< const InstanceInfo > | instances () const |
| Per-instance metadata for mapping global facet indices to (mesh, instance, local facet). | |
Stateful algorithm for finding occluded facets across every instance of a scene.
Each call to run_batch distributes rays over facets not yet decided, progressively improving the result. Per-facet results are addressed by a global facet index (mapped back via instances).
The sampling strategy is fixed at construction by OccludedFacetSamplerOptions::adaptive: plain cosine-weighted hemisphere sampling, or adaptive sampling that reuses escape directions to find small holes faster.
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
|
explicit |
Build the ray caster and per-instance world-space facet data.
| [in] | scene | Scene to process. Every referenced mesh must be a triangle mesh. |
| [in] | options | Sampler options. |
| [in] | is_occluder | Returns 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. |
|
nodiscard |
Total number of facets across all instances.
Multi-instance meshes are counted once per instance.
|
nodiscard |
Number of facets confidently above the keep threshold and retired from sampling.
This is useful to progressive callers for reporting and detecting that all facets have retired.