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 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.
SceneElement interface associates each tree node with a parameter
update map template contribution through its
property. Scene elements are categorized based on how they are expanded during
- Node scene element [
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.templateproperty. Optionally, child objects can also be declared with the
NodeSceneElement.objectsproperty for an easy forwarding of traversal.
- Instance scene element [
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
- Composite scene element [
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
The traversal protocol is different for each of these three elements types,
which all provide a different implementation of the
All scene elements can be recursively traversed using the
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#
Decide whether the scene element is a
CompositeSceneElement. In most cases, the choice is constrained by the scene element subtype. For example,
BSDFs are all
Surfaces are all
Derive a new class from the selected type and make sure that the properties mentioned in the Fundamentals section are all implemented.
When writing unit tests, make sure to include a basic sanity check using the