differt.scene.ExhaustivePathTracer#

class ExhaustivePathTracer(epsilon=None, hit_tol=None, min_len=None, smoothing_factor=None, confidence_threshold=0.5, batch_size=512, disconnect_inactive_triangles=False, chunk_size=None)[source]#

Bases: AbstractPathTracer

Exhaustive (image-method) path tracer.

All possible path candidates are generated and tested. This is the slowest method, but it is also the most accurate.

Attributes

batch_size

Intersection check batch size.

chunk_size

If specified, iterates through chunks of path candidates, yielding an iterator over path chunks.

confidence_threshold

Confidence threshold for valid paths.

disconnect_inactive_triangles

Whether to filter out inactive triangles first.

epsilon

Tolerance for checking ray / object intersections.

hit_tol

Tolerance for blockage checks.

min_len

Minimal (squared) length that each path segment must have for a path to be valid.

smoothing_factor

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

batch_size: int | None = 512#

Intersection check batch size.

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.

disconnect_inactive_triangles: bool = False#

Whether to filter out inactive triangles first.

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_candidates contains triangle indices. interaction_types classifies the bounce (e.g., 0 for specular). A value of -1 in either array indicates an “inactive” interaction or padded bounce (used when combining paths of different reflection orders).

Parameters:
  • scene (TriangleScene) – The scene.

  • order (int | Sequence[int]) – The path order (number of bounces), or a sequence of orders to combine.

  • specular_reflection (bool) – Whether to include specular reflections.

  • diffuse_scattering (bool) – Whether to include diffuse scattering (not yet implemented).

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:
Return type:

TracedPaths

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_size is provided, returns an iterator of TracedPaths (one per chunk); otherwise returns a single TracedPaths.

Parameters:
  • scene (TriangleScene) – The scene.

  • order (int | Sequence[int]) – The path order(s).

  • chunk_size (int | None) – If not None, iterate through chunks of this size.

  • pad_chunks (bool) – If True and chunk_size is set, pad the last chunk.

Return type:

TracedPaths | Iterator[TracedPaths]

Returns:

Traced paths, or an iterator thereof.