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.
Warning
The design presented in this page has several known issues which we hope to overcome in the future.
Fundamentals#
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 theirNodeSceneElement.template
property. Optionally, child objects can also be declared with theNodeSceneElement.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 theCompositeSceneElement.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#
Decide whether the scene element is a
NodeSceneElement
, anInstanceSceneElement
or aCompositeSceneElement
. In most cases, the choice is constrained by the scene element subtype. For example,BSDF
s are allNodeSceneElement
s,Surface
s are allCompositeSceneElement
s, etc.Derive a new class from the selected type and make sure that the properties mentioned in the Fundamentals section are all implemented.
Type
Properties
When writing unit tests, make sure to include a basic sanity check using the
check_scene_element()
function.