Radiometric kernel interface

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

Core 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.run(), 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 KernelContext instance, and its main purpose is to propagate coordinated scene parameter updates in the Mitsuba scene.

Kernel dictionary template

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

Kernel scene parameter map

A kernel scene parameter 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.

Kernel scene parameter map template

Kernel scene parameter maps are generated by rendering a scene parameter map template, defined using a KernelSceneParameterMap, a dict-like container whose entries are SceneParameter instances.

Scene parameter flags

Scene parameters can be attached flags defined by the KernelSceneParameterFlags enumeration. These can be used to indicate the type of changes to the scene triggered by an update of the parameter they are attached to. For instance, KernelSceneParameterFlags.GEOMETRIC is meant to mention that updating the associated parameter will trigger an intersection acceleration structure update, resulting in increased computation. Flags can be used when rendering scene parameter map templates to filter out some parameters.

How Eradiate calls Mitsuba

Eradiate’s core processing logic is split between the Experiment.init() and Experiment.process() methods: [1]

InitializationCreate a kernel scene object based on the experiment configuration.
  1. Translate the scene defined by the configuration of the current Experiment into a KernelDict and an KernelSceneParameterMap.

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

  3. Load the kernel scene.

ProcessingPerform a sequence of radiometric computations as part of a parametric loop.

For each kernel context of the experiment:

  1. Render the KernelSceneParameterMap template into a kernel scene parameter map.

  2. Update the kernel scene with the computed scene parameter map.

  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 scene parameter 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 search protocol used to work around Mitsuba’s hard-to-predict parameter naming.