Shapes

This section presents an overview of the shape plugins that are released along with the renderer.

In Mitsuba 3, shapes define surfaces that mark transitions between different types of materials. For instance, a shape could describe a boundary between air and a solid object, such as a piece of rock. Alternatively, a shape can mark the beginning of a region of space that isn’t solid at all, but rather contains a participating medium, such as smoke or steam. Finally, a shape can be used to create an object that emits light on its own.

Shapes are usually declared along with a BSDF characterizing the material’s response to light (see the respective section for more detail).

<scene version="3.0.0">
    <!-- .. scene contents .. -->

    <shape type=".. shape type ..">
        .. shape parameters ..

        <bsdf type=".. BSDF type ..">
            .. bsdf parameters ..
        </bsdf>

        <!-- Alternatively: reference a named BSDF that
            has been declared previously

            <ref id="my_bsdf"/>
        -->
    </shape>
</scene>

Visibility

Every shape accepts a visibility property that controls which rays can intersect it. The property can take on any of the following string values:

Value

Meaning

all

The shape is unconditionally visible. This is the default.

primary

The shape is visible to primary rays (i.e., to sensors) and invisible to secondary rays (shadow rays, indirect reflection). This feature is particularly useful for windows in interior scenes. In this case, the windows still appear in the rendered image, but indirect light can enter the room more easily without refraction. This improves the effectiveness of direct illumination sampling strategies and thereby reduces noise.

secondary

The shape is invisible to primary rays and visible to secondary rays. This is useful to place area lights into a scene without them appearing in the image, or to hide a light blocker from the camera.

hidden

The shape exists but is not observed by regular rays. This could be useful for implementing measurement surfaces (e.g. irradiance sensors) or to add a special type of geometry that is only found via explicit RayMask.All queries performed by a custom integrator.

This feature is best thought of as a filter on path space, where the overall integration remains unbiased apart from the removal of certain path configurations. Rays that a shape is invisible to pass through it and hit whatever lies behind.

An emitter that is invisible to secondary rays does not illuminate the scene and is never sampled. On area emitters, the visibility property must be specified on the shape rather than on the emitter. Emitters without a shape, such as constant and envmap, accept the same property directly.

Instances and shape groups reject the property. However, visibility flags may be specified on shapes within shape groups. Emitters that rays cannot intersect, such as point or directional lights, reject the property as well.

<shape type="rectangle">
    <string name="visibility" value="secondary"/>
    <emitter type="area">
        <rgb name="radiance" value="10"/>
    </emitter>
</shape>

Mesh parameters

Mitsuba provides several plugins that represent their geometry as a triangle mesh: obj, ply, and packed load meshes from the file format of the same name, and cube provides a built-in box primitive. All of them are instances of the same underlying mesh class and therefore expose an identical set of scene parameters through mi.traverse().

The parameters are row-major tensors, with F faces, V vertices, P surface points, and N normal groups:

Parameter

Type

Description

Flags

faces

TensorXu (F, 3)

Vertex indices of each triangle, in [0, V)

P, D

position_index

UInt32 (V,)

Surface point of each vertex, in [0, P). An empty list encodes the identity and indicates that P == V.

P, D

positions

TensorXf (P, 3)

Surface point positions in world space

P, ∂, D

normal_index

UInt32 (V,)

Normal group of each vertex, in [0, N). An empty list encodes the identity and indicates that N == V.

P

normals

TensorXf (N, 3)

Shading normals in world space, only present on meshes with vertex normals

P, ∂, D

texcoords

TensorXf (V, 2)

Per-vertex texture coordinates, only present on meshes with a UV parameterization

P, ∂

(Mesh attribute)

TensorXf (V, d) or (F, d)

Custom per-vertex or per-face attribute with d channels

P, ∂

Mitsuba Mesh class can choose to store attributes (positions, normals, UVs) at different granularities. This makes it possible to represent shapes that are geometrically continuous while having discontinuous normals or UVs. For example, it is relatively common for a mesh to have a crease edge where normals jump, or separate UV patches covering the geoemtry.

The naive way to represent parameter disconinuities involves splitting vertices so that the faces on either side get their own copy, but this also cuts the geometry apart. This causes normal creases, discontinuities in a differentiable renderer, and tearing under optimization.

Mitsuba uses the position_index and normal_index maps to map vertex indices to potentially coarser position and normal indices, so that copies split at a seam still reference the same underlying position or normal. This sharing removes the drawbacks of naive splitting mentioned above.

Everything else (texture coordinates, tangents, and mesh attributes) is indexed by vertex. Reading the texture coordinate of corner c of face f is therefore a direct lookup,

vertex_idx = faces[f][c]
texcoord   = texcoords[vertex_idx]

while positions and normals take one further step through their map:

vertex_idx   = faces[f][c]
position_idx = position_index[vertex_idx] if len(position_index) > 0 else vertex_idx
position     = positions[position_idx]

All parameters are writable and can may also change in shape (e.g., when remeshing to a different mesh resolution). Following an update, Mitsuba automatically keeps dependent state in sync, e.g., by regenerating shading normals when the geometry changes but no new normals were provided by the user.

The following subsections discuss the available shape types in greater detail.

Wavefront OBJ mesh loader (obj)

Parameter

Type

Description

Flags

filename

string

Filename of the OBJ file that should be loaded

face_normals

boolean

When set to true, any existing or computed vertex normals are discarded and face normals will instead be used during rendering. This gives the rendered object a faceted appearance. (Default: false)

flip_tex_coords

boolean

Treat the vertical component of the texture as inverted? Most OBJ files use this convention. (Default: true)

flip_normals

boolean

Is the mesh inverted, i.e. should the normal vectors be flipped? (Default:false, i.e. the normals point outside)

to_world

transform

Specifies an optional linear object-to-world transformation. (Default: none, i.e. object space = world space)

In addition, this plugin exposes the standard mesh state parameters documented in Mesh parameters.

This plugin implements a simple loader for Wavefront OBJ files. It handles meshes containing triangles and quadrilaterals, and it also imports vertex normals and texture coordinates.

Loading an ordinary OBJ file is as simple as writing:

<shape type="obj">
    <string name="filename" value="my_shape.obj"/>
</shape>

Note

Importing geometry via OBJ files should only be used as an absolutely last resort. Due to inherent limitations of this format, the files tend to be unreasonably large, and parsing them requires significant amounts of memory and processing power. What’s worse is that the internally stored data is often truncated, causing a loss of precision. If possible, use the ply or packed plugins instead.

PLY (Stanford Triangle Format) mesh loader (ply)

Parameter

Type

Description

Flags

filename

string

Filename of the PLY file that should be loaded

face_normals

boolean

When set to true, any existing or computed vertex normals are discarded and face normals will instead be used during rendering. This gives the rendered object a faceted appearance. (Default: false)

flip_tex_coords

boolean

Treat the vertical component of the texture as inverted? (Default: false)

flip_normals

boolean

Is the mesh inverted, i.e. should the normal vectors be flipped? (Default:false, i.e. the normals point outside)

to_world

transform

Specifies an optional linear object-to-world transformation. (Default: none, i.e. object space = world space)

In addition, this plugin exposes the standard mesh state parameters documented in Mesh parameters.

../../_images/shape_ply_bunny.jpg

The Stanford bunny loaded with face_normals=false.

../../_images/shape_ply_bunny_facet.jpg

The Stanford bunny loaded with face_normals=true. Note the faceted appearance.

This plugin implements a fast loader for the Stanford PLY format (both the ASCII and binary format, which is preferred for performance reasons). The current plugin implementation supports triangle meshes with optional UV coordinates, vertex normals and other custom vertex or face attributes.

Consecutive attributes with names sharing a common prefix and using one of the following schemes:

{prefix}_{x|y|z|w}, {prefix}_{r|g|b|a}, {prefix}_{0|1|2|3}, {prefix}_{1|2|3|4}

will be group together under a single multidimensional attribute named {vertex|face}_{prefix}.

RGB color attributes can also be defined without a prefix, following the naming scheme {r|g|b|a} or {red|green|blue|alpha}. Those attributes will be group together under a single multidimensional attribute named {vertex|face}_color.

<shape type="ply">
    <string name="filename" value="my_shape.ply"/>
    <boolean name="flip_normals" value="true"/>
</shape>

Note

Values stored in a RBG color attribute will automatically be converted into spectral model coefficients when using a spectral variant of the renderer.

Packed mesh loader (packed)

Parameter

Type

Description

Flags

filename

string

Filename of the .packed container that should be loaded

index

integer

A container may hold several meshes. This parameter specifies the index of the entry that should be loaded. (Default: 0, i.e. the first one)

name

string

Alternatively, this parameter selects an entry by its name.

face_normals

boolean

When set to true, any existing or computed vertex normals are discarded and emph{face normals} will instead be used during rendering. This gives the rendered object a faceted appearance. (Default: false)

flip_normals

boolean

Is the mesh inverted, i.e. should the normal vectors be flipped? (Default:false, i.e. the normals point outside)

to_world

transform

Specifies an optional linear object-to-world transformation. (Default: none, i.e. object space = world space)

In addition, this plugin exposes the standard mesh state parameters documented in Mesh parameters.

This plugin loads meshes from .packed containers, which represent the most space and time-efficient way of getting geometry information into Mitsuba 3. A container stores the internal representation of one or more meshes in a compressed form that matches the memory layout of the renderer and decompresses straight into the memory that the renderer uses. mitsuba.Mesh.write_packed() produces such files, and the file format description documents their layout. Loading a mesh from a container is considerably faster than the ply plugin and orders of magnitude faster than the obj plugin.

<shape type="packed">
    <string name="filename" value="meshes.packed"/>
    <string name="name" value="teapot"/>
    <bsdf type='diffuse'/>
</shape>

Cube (cube)

Parameter

Type

Description

Flags

flip_normals

boolean

Is the cube inverted, i.e. should the normal vectors be flipped? (Default:false, i.e. the normals point outside)

to_world

transform

Specifies an optional linear object-to-world transformation. (Default: none (i.e. object space = world space))

In addition, this plugin exposes the standard mesh state parameters documented in Mesh parameters.

This shape plugin describes a cube intersection primitive, based on the triangle mesh class. By default, it creates a cube between the world-space positions (−1, −1, −1) and (1, 1, 1). However, an arbitrary linear transformation may be specified to translate, rotate, scale or skew it as desired. The parameterization of this shape maps every face onto the rectangle \([0, 1]^2\) in uv space.

<shape type="cube">
    <transform name="to_world">
        <scale x="2" y="10" z="1"/>
    </transform>
</shape>

Sphere (sphere)

Parameter

Type

Description

Flags

center

point

Center of the sphere (Default: (0, 0, 0))

radius

float

Radius of the sphere (Default: 1)

flip_normals

boolean

Is the sphere inverted, i.e. should the normal vectors be flipped? (Default:false, i.e. the normals point outside)

to_world

transform

Specifies an optional linear object-to-world transformation. Note that non-uniform scales and shears are not permitted! (Default: none, i.e. object space = world space)

P, ∂, D

silhouette_sampling_weight

float

Weight associated with this shape when sampling silhoeuttes in the scene. (Default: 1)

P

../../_images/shape_sphere_basic.jpg

Basic example

../../_images/shape_sphere_parameterization.jpg

A textured sphere with the default parameterization

This shape plugin describes a simple sphere intersection primitive. It should always be preferred over sphere approximations modeled using triangles.

A sphere can either be configured using a linear to_world transformation or the center and radius parameters (or both). The two declarations below are equivalent.

<shape type="sphere">
    <transform name="to_world">
        <translate x="1" y="0" z="0"/>
        <scale value="2"/>
    </transform>
    <bsdf type="diffuse"/>
</shape>

<shape type="sphere">
    <point name="center" x="1" y="0" z="0"/>
    <float name="radius" value="2"/>
    <bsdf type="diffuse"/>
</shape>

When a sphere shape is turned into an area light source, Mitsuba 3 switches to an efficient sampling strategy by Fred Akalin that has particularly low variance. This makes it a good default choice for lighting new scenes.

../../_images/shape_sphere_light_mesh.jpg

Spherical area light modeled using triangles

../../_images/shape_sphere_light_analytic.jpg

Spherical area light modeled using the sphere plugin

Rectangle (rectangle)

Parameter

Type

Description

Flags

flip_normals

boolean

Is the rectangle inverted, i.e. should the normal vectors be flipped? (Default: false)

to_world

transform

Specifies a linear object-to-world transformation. (Default: none (i.e. object space = world space))

P, ∂, D

silhouette_sampling_weight

float

Weight associated with this shape when sampling silhoeuttes in the scene. (Default: 1)

P

../../_images/shape_rectangle.jpg

Basic example

../../_images/shape_rectangle_parameterization.jpg

A textured rectangle with the default parameterization

This shape plugin describes a simple rectangular shape primitive. It is mainly provided as a convenience for those cases when creating and loading an external mesh with two triangles is simply too tedious, e.g. when an area light source or a simple ground plane are needed. By default, the rectangle covers the XY-range \([-1,1]\times[-1,1]\) and has a surface normal that points into the positive Z-direction. To change the rectangle scale, rotation, or translation, use the to_world parameter.

The following XML snippet showcases a simple example of a textured rectangle:

<shape type="rectangle">
    <bsdf type="diffuse">
        <texture name="reflectance" type="checkerboard">
            <transform name="to_uv">
                <scale x="5" y="5" />
            </transform>
        </texture>
    </bsdf>
</shape>

Disk (disk)

Parameter

Type

Description

Flags

flip_normals

boolean

Is the disk inverted, i.e. should the normal vectors be flipped? (Default: false)

to_world

transform

Specifies a linear object-to-world transformation. Non-uniform scaling and shearing turn the disk into an ellipse. (Default: none, i.e. object space = world space)

P, ∂, D

silhouette_sampling_weight

float

Weight associated with this shape when sampling silhoeuttes in the scene. (Default: 1)

P

../../_images/shape_disk.jpg

Basic example

../../_images/shape_disk_parameterization.jpg

A textured disk with the default parameterization

This shape plugin describes a simple disk intersection primitive. It is usually preferable over discrete approximations made from triangles.

By default, the disk has unit radius and is located at the origin. Its surface normal points into the positive Z-direction. To change the disk scale, rotation, or translation, use the to_world parameter. The UV parameterization maps the u coordinate to the radius in object space and the v coordinate to the azimuth.

The following XML snippet instantiates an example of a textured disk shape:

<shape type="disk">
    <bsdf type="diffuse">
        <texture name="reflectance" type="checkerboard">
            <transform name="to_uv">
                <scale x="2" y="10" />
            </transform>
        </texture>
    </bsdf>
</shape>

Cylinder (cylinder)

Parameter

Type

Description

Flags

p0

point

Object-space starting point of the cylinder’s centerline. (Default: (0, 0, 0))

p1

point

Object-space endpoint of the cylinder’s centerline (Default: (0, 0, 1))

radius

float

Radius of the cylinder in object-space units (Default: 1)

flip_normals

boolean

Is the cylinder inverted, i.e. should the normal vectors be flipped? (Default: false, i.e. the normals point outside)

to_world

transform

Specifies an optional linear object-to-world transformation. Note that non-uniform scales are not permitted! (Default: none, i.e. object space = world space)

P, ∂, D

silhouette_sampling_weight

float

Weight associated with this shape when sampling silhoeuttes in the scene. (Default: 1)

P

../../_images/shape_cylinder_onesided.jpg

Cylinder with the default one-sided shading

../../_images/shape_cylinder_twosided.jpg

Cylinder with two-sided shading

This shape plugin describes a simple cylinder intersection primitive. It should always be preferred over approximations modeled using triangles. Note that the cylinder does not have endcaps – also, its normals point outward, which means that the inside will be treated as fully absorbing by most material models. If this is not desirable, consider using the twosided plugin.

A simple example for instantiating a cylinder, whose interior is visible:

<shape type="cylinder">
    <float name="radius" value="0.3"/>
    <bsdf type="twosided">
        <bsdf type="diffuse"/>
    </bsdf>
</shape>

B-spline curve (bsplinecurve)

Parameter

Type

Description

Flags

filename

string

Filename of the curves to be loaded, either a text file or a .packed container

index

integer

Index of the entry to load from a .packed container. (Default: 0)

name

string

Alternatively, the name of the entry to load from a .packed container.

State parameters

to_world

transform

Specifies a linear object-to-world transformation. Note that the control points’ raddii are invariant to this transformation!

silhouette_sampling_weight

float

Weight associated with this shape when sampling silhoeuttes in the scene. (Default: 1)

P

control_point_count

integer

Total number of control points

P

segment_indices

uint32[]

Starting indices of a B-Spline segment

P

control_points

float[]

Flattened control points buffer pre-multiplied by the object-to-world transformation. Each control point in the buffer is structured as follows: position_x, position_y, position_z, radius

P, ∂, D

../../_images/shape_bsplinecurve_basic.jpg

Basic example

../../_images/shape_bsplinecurve_parameterization.jpg

A textured B-spline curve with the default parameterization

This shape plugin describes multiple cubic B-spline curves. They are hollow cylindrical tubes which can have varying radii along their length and are open-ended: they do not have endcaps. They can be made watertight by setting the radii of the extremities to 0. This shape should always be preferred over curve approximations modeled using triangles.

Although it is possible to define multiple curves as multiple separate objects, this plugin was intended to be used as an aggregate of curves. Of course, if the individual curves need different materials or other individual characteristics they need to be defined in separate objects.

The file from which curves are loaded defines a single control point per line using four real numbers. The first three encode the position and the last one is the radius of the control point. At least four control points need to be specified for a single curve. Empty lines between control points are used to indicate the beginning of a new curve. Here is an example of two curves, the first with 4 control points and static radii and the second with 6 control points and increasing radii:

-1.0 0.1 0.1 0.5
-0.3 1.2 1.0 0.5
 0.3 0.3 1.1 0.5
 1.0 1.4 1.2 0.5

-1.0 5.0 2.2 1
-2.3 4.0 2.3 2
 3.3 3.0 2.2 3
 4.0 2.0 2.3 4
 4.0 1.0 2.2 5
 4.0 0.0 2.3 6

Large sets of curves are better stored in a .packed container, which holds the control points in a compressed binary form that loads considerably faster than the text format. The file format description documents the layout of a curve entry. When filename refers to a container, the index or name parameter selects the entry.

<shape type="bsplinecurve">
    <transform name="to_world">
        <scale value="2"/>
        <translate x="1" y="0" z="0"/>
    </transform>
    <string name="filename" type="curves.txt"/>
</shape>

Note

The backfaces of curves are always culled. It is therefore impossible to intersect the curve with a ray that’s origin is inside of the curve.

Linear curve (linearcurve)

Parameter

Type

Description

Flags

filename

string

Filename of the curves to be loaded, either a text file or a .packed container

index

integer

Index of the entry to load from a .packed container. (Default: 0)

State parameters

name

string

Alternatively, the name of the entry to load from a .packed container.

to_world

transform

Specifies a linear object-to-world transformation. Note that the control points’ raddii are invariant to this transformation!

control_point_count

integer

Total number of control points

P

segment_indices

uint32[]

Starting indices of a linear segment

P

control_points

float[]

Flattened control points buffer pre-multiplied by the object-to-world transformation. Each control point in the buffer is structured as follows: position_x, position_y, position_z, radius

P

../../_images/shape_linearcurve_basic.jpg

Basic example

../../_images/shape_linearcurve_parameterization.jpg

A textured linear curve with the default parameterization

This shape plugin describes multiple linear curves. They are hollow cylindrical tubes which can have varying radii along their length. The linear segments are connected by a smooth spherical joint, and they are also terminated by a spherical endcap. This shape should always be preferred over curve approximations modeled using triangles.

Although it is possible to define multiple curves as multiple separate objects, this plugin was intended to be used as an aggregate of curves. Of course, if the individual curves need different materials or other individual characteristics they need to be defined in separate objects.

The file from which curves are loaded defines a single control point per line using four real numbers. The first three encode the position and the last one is the radius of the control point. At least two control points need to be specified for a single curve. Empty lines between control points are used to indicate the beginning of a new curve. Here is an example of two curves, the first with 2 control points and static radii and the second with 4 control points and increasing radii:

-1.0 0.1 0.1 0.5
 1.0 1.4 1.2 0.5

-1.0 5.0 2.2 1
-2.3 4.0 2.3 2
 4.0 1.0 2.2 5
 4.0 0.0 2.3 6

Large sets of curves are better stored in a .packed container, which holds the control points in a compressed binary form that loads considerably faster than the text format. The file format description documents the layout of a curve entry. When filename refers to a container, the index or name parameter selects the entry.

<shape type="linearcurve">
    <transform name="to_world">
        <translate x="1" y="0" z="0"/>
        <scale value="2"/>
    </transform>
    <string name="filename" type="curves.txt"/>
</shape>

Note

The backfaces of curves are always culled. It is therefore impossible to intersect the curve with a ray that’s origin is inside of the curve.

SDF Grid (sdfgrid)

Parameter

Type

Description

Flags

filename

string

Filename of the SDF grid data to be loaded. The expected file format aligns with a single-channel grid-based volume data source. If no filename is provided, the shape is initialised as an empty 2x2x2 grid.

grid

tensor

Tensor array containing the grid data. This parameter can only be specified when building this plugin at runtime from Python or C++ and cannot be specified in the XML scene description.

P, ∂, D

normals

string

Specifies the method for computing shading normals. The options are analytic or smooth. (Default: smooth)

to_world

transform

Specifies a linear object-to-world transformation. (Default: none (i.e. object space = world space))

P, ∂, D

../../_images/shape_sdfgrid.jpg

SDF grid with smooth shading normals

../../_images/shape_sdfgrid_analytic.jpg

SDF grid with analytic shading normals

This shape plugin describes a signed distance function (SDF) grid shape primitive — that is, an SDF sampled onto a three-dimensional grid. The grid object-space is mapped over the range \([0,1]^3\).

A smooth method for computing normals [SEAM22] is selected as the default approach to ensure continuity across grid cells.

Warning

Compared with the other available shape plugins, the SDF grid has a few important limitations. Namely:

  • It does not emit UV coordinates for texturing.

  • It cannot be used as an area emitter.

Note

When differentiating this shape, it does not leverage the work presented in [VSJ22]. However, a Mitsuba 3-based implementation of that technique is available on its project’s page.

<shape type="sdfgrid">
    <string name="filename" value="data.sdf"/>
    <bsdf type="diffuse"/>
</shape>

Shape group (shapegroup)

Parameter

Type

Description

Flags

(Nested plugin)

shape

One or more shapes that should be made available for geometry instancing

This plugin implements a container for shapes that should be made available for geometry instancing. Any shapes placed in a shapegroup will not be visible on their own—instead, the renderer will precompute ray intersection acceleration data structures so that they can efficiently be referenced many times using the Instance (instance) plugin. This is useful for rendering things like forests, where only a few distinct types of trees have to be kept in memory. An example is given below:

<!-- Declare a named shape group containing two objects -->
<shape type="shapegroup" id="my_shape_group">
    <shape type="ply">
        <string name="filename" value="data.ply"/>
        <bsdf type="roughconductor"/>
    </shape>
    <shape type="sphere">
        <transform name="to_world">
            <translate y="20"/>
            <scale value="5"/>
        </transform>
        <bsdf type="diffuse"/>
    </shape>
</shape>

<!-- Instantiate the shape group without any kind of transformation -->
<shape type="instance">
    <ref id="my_shape_group"/>
</shape>

<!-- Create instance of the shape group, but rotated, scaled, and translated -->
<shape type="instance">
    <ref id="my_shape_group"/>
    <transform name="to_world">
        <translate z="10"/>
        <scale value="1.5"/>
        <rotate x="1" angle="45"/>
    </transform>
</shape>

Instance (instance)

Parameter

Type

Description

Flags

(Nested plugin)

shapegroup

A reference to a shape group that should be instantiated.

to_world

transform

Specifies a linear object-to-world transformation. (Default: none (i.e. object space = world space))

P, ∂, D

This plugin implements a geometry instance used to efficiently replicate geometry many times. For details on how to create instances, refer to the Shape group (shapegroup) plugin.

../../_images/shape_instance_fractal.jpg

The Stanford bunny loaded a single time and instantiated 1365 times (equivalent to 100 million triangles)

Warning

  • Note that it is not possible to assign a different material to each instance. The material assignment specified within the shape group is the one that matters.

  • Shape groups cannot be used to replicate shapes with attached emitters, sensors, or subsurface scattering models.

Displaced mesh (displace)

Parameter

Type

Description

Flags

(Nested plugin)

|shape|

The mesh to displace. Any mesh-type shape (e.g. ply, obj, or packed) may be specified here.

height

texture

Height field that is evaluated at each vertex. A spatially varying texture requires the nested mesh to have texture coordinates. (Default: 0.5)

scale

float

Distance by which a unit height moves a vertex. (Default: 1)

midlevel

float

Height value at which the surface stays in place. (Default: 0.5)

face_normals

boolean

When set to true, the displaced mesh uses face normals, which gives it a faceted appearance. (Default: inherited from the nested mesh)

flip_normals

boolean

Is the mesh inverted, i.e. should the normal vectors be flipped? (Default: false, i.e. the normals point outside)

to_world

transform

Specifies an optional linear object-to-world transformation. (Default: none, i.e. object space = world space)

In addition, this plugin exposes the standard mesh state parameters documented in Mesh parameters.

This plugin displaces every vertex of a nested mesh along its normal by

\[d = (h(u, v) - \texttt{midlevel}) \cdot \texttt{scale},\]

where \(h\) is the value of the height texture at the vertex. Displacement happens in the coordinate system of the nested mesh, i.e. before the to_world transformation of this plugin is applied.

The plugin does not tessellate the input. The nested mesh must already be fine enough to resolve the height field.

<shape type="displace">
    <shape type="ply">
        <string name="filename" value="wall.ply"/>
    </shape>
    <texture type="bitmap" name="height">
        <string name="filename" value="bricks_height.png"/>
        <boolean name="raw" value="true"/>
    </texture>
    <float name="scale" value="0.02"/>
    <float name="midlevel" value="0"/>
    <bsdf type="diffuse"/>
</shape>

Ellipsoids (ellipsoids)

Parameter

Type

Description

Flags

filename

string

Specifies the PLY file containing the ellipsoid centers, scales, and quaternions. This parameter cannot be used if data or centers are provided.

data

tensor

A tensor of shape (N, 10) or (N * 10) that defines the ellipsoid centers, scales, and quaternions. This parameter cannot be used if filename or centers are provided.

centers

tensor

A tensor of shape (N, 3) specifying the ellipsoid centers. This parameter cannot be used if filename or data are provided.

scales

tensor

A tensor of shape (N, 3) specifying the ellipsoid scales. This parameter cannot be used if filename or data are provided.

quaternions

tensor

A tensor of shape (N, 3) specifying the ellipsoid quaternions. This parameter cannot be used if filename or data are provided.

scale_factor

float

A scaling factor applied to all ellipsoids when loading from a PLY file. (Default: 1.0)

extent

float

Specifies the extent of the ellipsoid. This effectively acts as an extra scaling factor on the ellipsoid, without having to alter the scale parameters. (Default: 3.0)

R

extent_adaptive_clamping

float

If True, use adaptive extent values based on the opacities attribute of the volumetric primitives. (Default: False)

R

to_world

transform

Specifies an optional linear object-to-world transformation to apply to all ellipsoids.

P, ∂, D

(Nested plugin)

tensor

Specifies arbitrary ellipsoids attribute as a tensor of shape (N, D) with D the dimensionality of the attribute. For instance this can be used to define an opacity value for each ellipsoids, or a set of spherical harmonic coefficients as used in the volprim_rf_basic integrator.

This shape plugin defines a point cloud of anisotropic ellipsoid primitives using specified centers, scales, and quaternions. It employs a closed-form ray-intersection formula with backface culling. Although it is slower than the ellipsoidsmesh shape plugin, which uses tessellated ellipsoids for ray-triangle intersection hardware acceleration, it offers greater flexibility in computing intersections.

This shape also exposes an extent parameter, it acts as an extra scaling factor for the ellipsoids’ scales. Typically, this is used to define the support of a kernel function defined within the ellipsoid. For example, the scale parmaters of the ellipsoid will define the variances of a gaussian and the extent will multiple those value to define the effictive radius of the ellipsoid. When extent_adaptive_clamping is enabled, the extent is additionally multiplied by an opacity-dependent factor:\(\sqrt{2 * \log(opacity / 0.01)} / 3\)

It is designed for use with volumetric primitive integrators, as detailed in [CSB+25].

<shape type="ellipsoids">
    <string name="filename" value="my_primitives.ply"/>
</shape>

Mesh ellipsoids (ellipsoidsmesh)

Parameter

Type

Description

Flags

filename

string

Specifies the PLY file containing the ellipsoid centers, scales, and quaternions. This parameter cannot be used if data or centers are provided.

data

tensor

A tensor of shape (N, 10) or (N * 10) that defines the ellipsoid centers, scales, and quaternions. This parameter cannot be used if filename or centers are provided.

centers

tensor

A tensor of shape (N, 3) specifying the ellipsoid centers. This parameter cannot be used if filename or data are provided.

scales

tensor

A tensor of shape (N, 3) specifying the ellipsoid scales. This parameter cannot be used if filename or data are provided.

quaternions

tensor

A tensor of shape (N, 3) specifying the ellipsoid quaternions. This parameter cannot be used if filename or data are provided.

scale_factor

float

A scaling factor applied to all ellipsoids when loading from a PLY file. (Default: 1.0)

extent

float

Specifies the extent of the ellipsoid. This effectively acts as an extra scaling factor on the ellipsoid, without having to alter the scale parameters. (Default: 3.0)

R

extent_adaptive_clamping

float

If True, use adaptive extent values based on the opacities attribute of the volumetric primitives. (Default: False)

R

shell

string or mesh

Specifies the shell type. Could be one of box, ico_sphere, or uv_sphere, as well as a custom child mesh object. (Default: ico_sphere)

to_world

transform

Specifies an optional linear object-to-world transformation to apply to all ellipsoids.

P, ∂, D

(Nested plugin)

tensor

Specifies arbitrary ellipsoids attribute as a tensor of shape (N, D) with D the dimensionality of the attribute. For instance this can be used to define an opacity value for each ellipsoids, or a set of spherical harmonic coefficients as used in the volprim_rf_basic integrator.

This shape plugin defines a point cloud of anisotropic ellipsoid primitives given centers, scales, and quaternions, using a mesh-based representation with backface culling. This plugin is designed to leverage hardware acceleration for ray-triangle intersections, providing a performance advantage over analytical ellipsoid representations.

This shape also exposes an extent parameter, it acts as an extra scaling factor for the ellipsoids’ scales. Typically, this is used to define the support of a kernel function defined within the ellipsoid. For example, the scale parmaters of the ellipsoid will define the variances of a gaussian and the extent will multiple those value to define the effictive radius of the ellipsoid. When extent_adaptive_clamping is enabled, the extent is additionally multiplied by an opacity-dependent factor:\(\sqrt{2 * \log(opacity / 0.01)} / 3\)

This shape is designed for use with volumetric primitive integrators, as detailed in [CSB+25].

<shape type="ellipsoidsmesh">
    <string name="filename" value="my_primitives.ply"/>
</shape>