Radiometric kernel interface#

Eradiate’s radiometric computations are performed by its radiometric kernel Mitsuba 3, with minor modifications. Mitsuba is accessed through a set of convenience functions and classes presented in this document.

Basic concepts#

Mitsuba object#
Kernel object#

Mitsuba has its internal scene representation. It consists of a tree whose nodes and leaves are mitsuba.Object instances.

Mitsuba scene#
Kernel scene#

A mitsuba.Scene instance.

Mitsuba scene dictionary#
Kernel dictionary#

Mitsuba’s Python interface can load objects specified in the XML format, through the mitsuba.load_file() and mitsuba.load_string() functions, or as Python dictionaries, using the mitsuba.load_dict() function. Eradiate uses the latter and its scene generator emits scene dictionaries based on the Eradiate scene specification.

Mitsuba scene rendering#
Radiometric computation#

A Mitsuba scene can be rendered for a specific sensor using the mitsuba.render() function. This triggers a radiometric computation.

Mitsuba scene parameters#

Mitsuba objects declare parameters which can be collected using the mitsuba.traverse() function. The parameter table yielded by this function (a mitsuba.SceneParameters instance) can then be modified to edit scene parameters.

See also

Editing a scene tutorial in the Mitsuba docs.

Parametric loop#

Upon a call to, Eradiate initializes a kernel scene. It then runs a sequence of radiometric computations as part of a parametric loop. Each iteration of the parametric loop corresponds to different Mitsuba scene parameters. Consequently, each iteration consists of a parameter update operation and a rendering operation.

Kernel context#

Scene parameters are determined by a parametric context internal to the experiment being processed. The context can carry any kind of relevant information: the current spectral coordinate, the Mitsuba ID of a mitsuba.Medium object attached to a sensor, etc. The kernel context is defined by a KernelDictContext instance.

Kernel dictionary template#

Kernel dictionaries can be created from templates defined using the KernelDictTemplate class. Those objects are dict-like containers whose entries may be InitParameter objects, which are expanded contextually upon a call to the KernelDictTemplate.render() method.

Parameter update map#

A scene parameter update map is generated at each iteration of the parametric loop depending on contextual information. It is then used to update the scene parameters using the mitsuba.SceneParameters.update() method.

Parameter update map template#

Parameter update maps are generated by rendering a parameter update map template, defined using a UpdateMapTemplate, a dict-like container whose entries are UpdateParameter instances.

How Eradiate calls Mitsuba#

Eradiate’s core processing logic is defined in the Experiment.process() method, which performs the following steps:

  1. Translate the scene defined by the configuration of the current Experiment into a KernelDictTemplate and an UpdateMapTemplate.

  2. Render the kernel dictionary template into a kernel dictionary using an arbitrary initialization kernel context.

  3. Load the kernel scene.

  4. For each kernel context of the experiment:

    1. Render the UpdateMapTemplate into a parameter update map.

    2. Update the kernel scene.

    3. Launch a radiometric computation with the updated scene.

    4. Collect the raw results and store them in a simple data structure.

Low-level kernel interface#

Step 4 of the Experiment.process() is implemented by the mi_render() function. It manipulates an instance of the MitsubaObjectWrapper which encapsulates a Mitsuba scene alongside its scene parameters and an update map template and makes a Mitsuba scene update and render for each kernel context it gets as argument.

The MitsubaObjectWrapper instance should be obtained by traversing a Mitsuba object (typically a mitsuba.Scene with the mi_traverse() function. The latter reimplements mitsuba.traverse() and adds an advanced parameter name lookup protocol used.

Mitsuba scene parameter name lookup#

Mitsuba’s scene definition and internal representation can differ, which can make the task of predicting scene parameter names very challenging. This problem is documented in this discussion on the Mitsuba repository . Our solution is the addition of a name lookup protocol to the Mitsuba object tree traversal function mi_traverse(). In addition to the traversed Mitsuba object, mi_traverse() can be passed a parameter update map template. Each UpdateParameter of the update map template has an optional lookup_strategy field, which can be used to detect the name of the corresponding scene parameter.

Currently, only the TypeIdLookupStrategy is available. This strategy searches for a Mitsuba object tree node of a specified type and with the specified object identifier. mitsuba.Medium and mitsuba.BSDF objects usually require a name lookup because they can be referenced by an arbitrary number of other objects, with no certainty on which of the referencing objects will be visited first during traversal and therefore will define the parameter names.