Participating media¶
Piecewise medium (piecewise)¶
Parameter |
Type |
Description |
Flags |
|---|---|---|---|
albedo |
float, spectrum or volume |
Single-scattering albedo of the medium. Default: 0.75 |
P, ∂ |
sigma_t |
float, spectrum or volume |
Extinction coefficient in inverse scene units. The supplied grid must be of shape [1,1,n]. Default: 1.0 |
P, ∂ |
scale |
float |
Optional scale factor that will be applied to the extinction parameter. It is provided for convenience when accommodating data based on different units, or to simply tweak the density of the medium. Default: 1.0 |
P |
sample_emitters |
boolean |
Flag to specify whether shadow rays should be cast from inside the volume. If the medium is enclosed in a dielectric boundary, shadow rays are ineffective and turning them off will significantly reduce render time. This can reduce render time up to 50% when rendering objects with subsurface scattering. Default: true |
|
(Nested plugin) |
phase |
A nested phase function that describes the directional scattering properties of the medium. When none is specified, the renderer will automatically use an instance of isotropic. |
P, ∂ |
This plugin provides a 1D heterogeneous medium implementation (plane-parallel geometry), which acquires its data from nested volume instances. These can be constant, use a procedural function, or fetch data from disk, e.g. using a 3D grid, as long as the underlying grid has the shape [1,1,N], with N the number of layers on the vertical (z) axis.
The medium is parametrized by the single-scattering albedo and the extinction coefficient \(\sigma_t\). The extinction coefficient should be provided in inverse scene units. For instance, when a world-space distance of 1 unit corresponds to 1 metre, the extinction coefficient should have units of inverse meters. For convenience, the scale parameter can be used to correct the units. For instance, when the scene is in meters and the coefficients are in inverse millimetres, set scale to 1000.
Both the albedo and the extinction coefficient can either be constant or textured, and both parameters are allowed to be spectrally varying.
<!-- Declare a piecewise participating medium named 'smoke' -->
<medium type="piecewise" id="smoke">
<!-- Acquire extinction values from an external data file -->
<volume name="sigma_t" type="gridvolume">
<string name="filename" value="frame_0150.vol"/>
</volume>
<!-- The albedo is constant and set to 0.9 -->
<float name="albedo" value="0.9"/>
<!-- Use an isotropic phase function -->
<phase type="isotropic"/>
<!-- Scale the density values as desired -->
<float name="scale" value="200"/>
</medium>
<!-- Attach the index-matched medium to a shape in the scene -->
<shape type="obj">
<!-- Load an OBJ file, which contains a mesh version
of the axis-aligned box of the volume data file -->
<string name="filename" value="bounds.obj"/>
<!-- Reference the medium by ID -->
<ref name="interior" id="smoke"/>
<!-- If desired, this shape could also declare
a BSDF to create an index-mismatched
transition, e.g.
<bsdf type="dielectric"/>
-->
</shape>
# Declare a piecewise participating medium named 'smoke'
'smoke': {
'type': 'piecewise',
# Acquire extinction values from an external data file
'sigma_t': {
'type': 'gridvolume',
'filename': 'frame_0150.vol'
},
# The albedo is constant and set to 0.9
'albedo': 0.9,
# Use an isotropic phase function
'phase': {
'type': 'isotropic'
},
# Scale the density values as desired
'scale': 200
},
# Attach the index-matched medium to a shape in the scene
'shape': {
'type': 'obj',
# Load an OBJ file, which contains a mesh version
# of the axis-aligned box of the volume data file
'filename': 'bounds.obj',
# Reference the medium by ID
'interior': 'smoke',
# If desired, this shape could also declare
# a BSDF to create an index-mismatched
# transition, e.g.
# 'bsdf': {
# 'type': 'isotropic'
# },
}