eradiate.scenes.phase.MultiPhaseFunction#

class eradiate.scenes.phase.MultiPhaseFunction(id='phase', geometry=None, *, components, weights, use_mis=True)#

Bases: PhaseFunction

Multi phase function.

Aggregates two or more sub-phase functions (components) and blends them based on its weights parameter. Weights are typically the associated medium’s scattering coefficient.

traverse(callback)#

Traverse this scene element and collect kernel dictionary template and parameter update map contributions.

Parameters:

callback (SceneTraversal) – Callback data structure storing the collected data.

update()#

Enforce internal state consistency. This method should be called when fields are modified. It is automatically called as a post-init step.

with_normalized_weights(ctx)#

Return a copy of this phase function with per-cell weights rescaled to sum to 1 across components.

The returned instance’s weights is always a plain ndarray, even if self.weights was a list of callables: this evaluates them (and the normalization) at ctx.si, so the result is a snapshot at that one spectral index, not a phase function that stays normalized under further context changes.

Parameters:

ctx (KernelContext) – Context at which weights are evaluated before normalization.

Returns:

MultiPhaseFunction – A new instance with the same components and geometry, and weights normalized to sum to 1 in every cell.

property objects#

Map of child objects associated with this scene element.

Returns:

dict – A dictionary mapping object names to a corresponding object to be inserted in the Eradiate scene graph.

property params#
Returns:

dict[str, SceneParameter] or None – A dictionary mapping parameter paths, consisting of dot-separated strings, to a corresponding update protocol.

property template#

Kernel dictionary template contents associated with this scene element.

Returns:

dict – A flat dictionary mapping dot-separated strings describing the path of an item in the nested scene dictionary to values. Values may be objects which can be directly used by the mitsuba.load_dict() function, or DictParameter instances which must be rendered.