Scene generator design

Scene generator design#

Eradiate’s scene generator design is tightly coupled with its radiometric kernel interface. This document presents the general underlying design and briefly explains how to create new scene elements.


The design presented in this page has several known issues which we hope to overcome in the future.


Eradiate splits scene definition into scene elements. Scene elements inherit the SceneElement interface and are assembled into a tree which is traversed to assemble a kernel dictionary template and a parameter update map template during the initialization phase of the processing pipeline. We will elaborate on the traversal step later.

The SceneElement interface associates each tree node with a parameter update map template contribution through its SceneElement.params property. Scene elements are categorized based on how they are expanded during traversal:

Node scene element [NodeSceneElement]

Node scene elements expand as proper nodes in the Mitsuba scene graph and can be initialized using a kernel dictionary entry. They provide abstractions very close to Mitsuba’s. Typical examples are BSDFs [eradiate.scenes.bsdfs] and spectra [eradiate.scenes.spectra]. Node scene elements provide a scene dictionary template contribution with their NodeSceneElement.template property. Optionally, child objects can also be declared with the NodeSceneElement.objects property for an easy forwarding of traversal.

Instance scene element [InstanceSceneElement]

Instance scene elements expand as a single Mitsuba object instance. They cannot be expressed as a kernel scene dictionary part. They return the generated Mitsuba object through their InstanceSceneElement.instance property.

Composite scene element [CompositeSceneElement]

Composite scene elements expand to multiple Mitsuba scene tree nodes and can be expressed as kernel scene dictionary parts. The kernel dictionary template contribution is provided by the CompositeSceneElement.template. Child objects are declared using the CompositeSceneElement.objects property.

The traversal protocol is different for each of these three elements types, which all provide a different implementation of the SceneElement.traverse() method.

All scene elements can be recursively traversed using the traverse() function. This function outputs a pair consisting of a kernel dictionary template and a parameter update map template, which are then used by the Experiment to assemble a Mitsuba scene and update it as part of the parametric loop.

Writing a new scene element class#

  1. Decide whether the scene element is a NodeSceneElement, an InstanceSceneElement or a CompositeSceneElement. In most cases, the choice is constrained by the scene element subtype. For example, BSDFs are all NodeSceneElements, Surfaces are all CompositeSceneElements, etc.

  2. Derive a new class from the selected type and make sure that the properties mentioned in the Fundamentals section are all implemented.




    template, params [, objects]


    instance, params


    template, params [, objects]

  3. When writing unit tests, make sure to include a basic sanity check using the check_scene_element() function.