differt.scene.HybridPathTracer#
- class HybridPathTracer(num_rays=1000000, epsilon=None, hit_tol=None, min_len=None, smoothing_factor=None, confidence_threshold=0.5, batch_size=512, chunk_size=None)[source]#
Bases:
AbstractPathTracerHybrid path tracer, combining ray launching for visibility and exhaustive tracing.
Uses ray launching to estimate object visibility, then performs exhaustive search on the reduced candidate set. This is a faster alternative to exhaustive search, but still grows exponentially with the number of bounces or the size of the scene.
Warning
This method is best used for a single transmitter and a single receiver, as the estimated visibility is merged across all transmitters and receivers, respectively.
Attributes
Intersection check batch size.
If specified, iterates through chunks of path candidates, yielding an iterator over path chunks.
Confidence threshold for valid paths.
Tolerance for checking ray / object intersections.
Tolerance for blockage checks.
Minimal (squared) length that each path segment must have for a path to be valid.
The number of rays launched.
Parameters for slope of the smoothing function.
Methods
generate_path_candidates(scene, order[, ...])Return a tuple of
(path_candidates, interaction_types).generate_path_candidates_chunks_iter(scene, ...)Override to support native chunked generation from the graph.
trace_path_candidates(scene, ...)Core logic to trace the exact paths from the proposed candidates.
trace_paths(scene, order[, chunk_size, ...])Trace paths for the given scene and order(s).
Detailed documentation
-
chunk_size:
int|None= None# If specified, iterates through chunks of path candidates, yielding an iterator over path chunks.
-
confidence_threshold:
Float[ArrayLike, '']= 0.5# Confidence threshold for valid paths.
-
epsilon:
Float[ArrayLike, '']|None= None# Tolerance for checking ray / object intersections.
- generate_path_candidates(scene, order, specular_reflection=True, diffuse_scattering=False)[source]#
Return a tuple of
(path_candidates, interaction_types).path_candidatescontains triangle indices.interaction_typesclassifies the bounce (e.g.,0for specular). A value of-1in either array indicates an “inactive” interaction or padded bounce (used when combining paths of different reflection orders).- Parameters:
- Return type:
tuple[Int[Array, 'num_candidates order'],Int[Array, 'num_candidates order']]- Returns:
A 2-tuple of
(path_candidates, interaction_types).
- generate_path_candidates_chunks_iter(scene, order, *args, chunk_size=None, pad_chunks=False, **kwargs)[source]#
Override to support native chunked generation from the graph.
- Return type:
SizedIterator[tuple[chunk_size order'],chunk_size order']]]- Returns:
An iterator over path candidates chunks.
-
hit_tol:
Float[ArrayLike, '']|None= None# Tolerance for blockage checks.
-
min_len:
Float[ArrayLike, '']|None= None# Minimal (squared) length that each path segment must have for a path to be valid.
-
smoothing_factor:
Float[ArrayLike, '']|None= None# Parameters for slope of the smoothing function.
- trace_path_candidates(scene, path_candidates, interaction_types)[source]#
Core logic to trace the exact paths from the proposed candidates.
- Parameters:
scene (
TriangleScene) – The scene.path_candidates (
Int[Array, 'num_candidates order']) – Triangle indices for each candidate.interaction_types (
Int[Array, 'num_candidates order']) – Interaction type for each bounce.
- Return type:
- Returns:
The traced paths.
- trace_paths(scene, order, chunk_size=None, pad_chunks=False)[source]#
Trace paths for the given scene and order(s).
If
chunk_sizeis provided, returns an iterator ofTracedPaths(one per chunk); otherwise returns a singleTracedPaths.- Parameters:
- Return type:
- Returns:
Traced paths, or an iterator thereof.
-
chunk_size: