PxrVolume

PxrVolume

images/bxdfball_volume.png

PxrVolume is a material that can be used to render a wide range of participating media. Its scattering model uses the Henyey-Greenstein phase function commonly used for anisotropic media; it can also efficiently handle isotropic scattering. Both heterogeneous and homogeneous volumes are handled, as well as multiple scattering effects.

Users of PxrVolume should be aware of the difference between homogeneous volumes and heterogeneous volumes: homogenous volumes have constant density and color, both of which can easily be represented by a single float (for density) or single color value. Heterogeneous volumes can have varying density and/or color, typically determined via textures or from primvar data associated with e.g. OpenVDB. PxrVolume is particularly optimized for homogeneous volumes. Any use of a connection on the Density or Diffuse Color knobs will make the volume heterogeneous, and such volumes are typically much slower (and noisier) to render than homogeneous volumes.

A note on ShadingRate: for RiVolumes, the memory used in automatically computing density bounds is controlled by ShadingRate (please refer to the discussion below about the Max Density parameter). The default ShadingRate setting of 1 is typically enough. For large resolution renders or sparse volumes, the trade-off between memory used and time spent computing bounds versus time saved by having automatic bounding may be less useful. Higher ShadingRates may be beneficial in these cases.

PxrVolume can be attached to any closed, watertight surface, and not just RiVolume, with certain caveats:

  • works great for homogeneous volumes (as mentioned above)
  • works fine for heterogeneous volumes as long as no 3D primvars are needed, other than builtins. If other 3D primvars are needed in the execution of the pattern graph, RiVolume must be used (since surfaces cannot be used as a source of 3D primvars).
  • volumes must be modeled so that their envelopes are not coincident with other geometry, including other volumes. This restriction does not fully apply to RiVolume: RiVolume may share coincident faces with other RiVolumes and may be coincident with other geometry.
  • the camera cannot be placed inside an arbitrary surface, only inside a RiVolume
  • lights cannot be placed inside an arbitrary surface when using bidirectional path tracing, only inside a RiVolume

Parameters

Diffuse Color

The color of the volume. Default is white (1,1,1). Making a connection on this parameter will create a heterogeneous volume.

If you are familiar with scattering, absorption, and extinction coefficients, note that the diffuse color here is the scattering albedo, which is the scattering coefficient divided by the extinction coefficient.

images/pxrVolume/pxrVolumeDiffuseColor.png

Red, Green, and Blue diffuseColors, from left to right

Emit Color

The emissive color of the volume. This is useful for modeling effects such as phosphorescent fog or fire. Default is black (0,0,0), i.e. the volume will not emit light.
images/pxrVolume/pxrVolumeEmitColor.png

Red, Green, and Blue emitColors, from left to right

Density Color

The density of the volume directly controls how light is attenuated by the volume - i.e. it directly affects how the volume casts shadows. The density color parameter overrides the density float if density color is changed from its default value. If you do not need colored shadows from the volume, then you should set the density float parameter and leave the density color parameter untouched; the volume will render more efficiently.

Making a connection on this parameter will create a heterogeneous volume.

In PxrVolume, the density is the extinction coefficient (which is the sum of the absorption and scattering coefficients).

images/pxrVolume/pxrVolumeDensityColor.png

densityColor of [1 0.5 0.5], [0.5 1.0 0.5] and [0.5 0.5 1.0], from left to right

Density Color PrimVar

A primvar from the geometry which overrides the density color of the volume, unset by default. Setting this overrides the densityColor input, and is more efficient than simply using a PxrPrimVar pattern connection.

Density Float

The density of the volume directly controls how light is attenuated by the volume - i.e. it directly affects how the volume casts shadows. The density float parameter is overridden by the density color if density color is changed from its default value. Unless you require colored shadows, you should prefer to set this parameter rather than the density color parameter as the volume will render more efficiently.

Making a connection on this parameter will create a heterogeneous volume.

In PxrVolume, the density is the extinction coefficient (which is the sum of the absorption and scattering coefficients).

images/pxrVolume/pxrVolumeDensityFloat.png

densityFloat of 2.0, 0.5, and 0.25, from left to right

Density Float PrimVar

A primvar from the geometry which overrides the density float of the volume, unset by default. Setting this overrides the densityFloat input, and is more efficient than simply using a PxrPrimVar pattern connection.

Anisotropy

Controls the direction in which volume scatters light. Anisotropy has a range of -1 to 1 and the default is 0 (isotropic). A value of 0 for anisotropy means the volume is isotropic: light is scattered in all directions with equal probability. A value greater than 0 means the volume is forward scattering: incoming light has a higher chance of being scattered in the same direction (i.e. away from the incoming light). A value of anisotropy less than 0 means the volume is backwards scattering: incoming light has a higher chance of being scattered in the reverse direction (i.e. back towards the direction of incoming light).

Note that isotropic volumes may be faster/less noisy to render than anisotropic volumes.

images/pxrVolume/pxrVolumeAnisotropy.png

anisotropy of -0.8, 0, and 0.8, from left to right. Rendered using VCM with path length 4, multiscatter turned on

Max Density

The max density parameter is only used by heterogeneous volumes and controls the step size used to sample the volume. For correctly unbiased rendering, the max density must be higher than any density encountered inside the volume. A high value of max density may result in slower renders since more steps will be taken to sample the volume. Setting the max density too small will speed up your render, but will also lead to incorrect (biased) rendering as dense regions of the volume will be undersampled.

Starting in version 20.7, for RiVolumes only, PxrVolume will also automatically compute the density bounds over the subsections of the volume, and use this information to vary the step size over the ray. This means that more steps will only be taken in denser parts of the volume. Therefore, for very heterogeneous volumes, setting a higher value for max density will no longer have a detrimental effect over the entire volume; in practice, it is often possible to simply set this to a very high value and not worry about this parameter any further.

The default value of max density is 1.0.

Multi Scatter

Used as a hint as to whether the volume should compute indirect illumination inside the volume (also known as multiple scattering, because light will scatter more than once inside the volume). If the multi scatter parameter is set to 0, and the integrator respects this hint, PxrVolume will only perform single scattering: points inside the volume will only be lit directly by light sources. If set to 1, points inside the volume will be lit by indirect illumination as well.

For very dense volumes with high anisotropy, it is often the case that light will scatter many times inside the volume before reaching the eye, and multiple scattering is the only way to achieve the correct look. It is also often the only way to correctly render certain effects such as volume caustics. On the other hand, multiple scattering can be very expensive, which is why the parameter defaults to 0 (off). Moreover, when rendering homogeneous volumes, turning off multiple scattering may result in less noise for directly lit surfaces behind the volume.

Note that due the nature of their algorithm, some integrators (in particular, bidirectional path tracers such as PxrVCM) have no choice but to implement multiple scattering of volumes, and therefore will ignore this hint.

images/pxrVolume/pxrVolumeMultiScatter.png

Left column: multi scatter off. Right column: multi scatter on.

Equiangular Weight

Sets the probability of equiangular sampling being used instead of density sampling. Equiangular sampling improves the convergence of volumes close to light sources, while density sampling can be a better technique when dealing with volumes with dense or highly varying density. The default value of 0.5 means both techniques will be used equally and combined with multiple importance sampling. If the volumes are dense and far away from light sources then decreasing the equiangular weight may result in better convergence.

Samples

This setting controls sample quality for single scatter volumes. Increasing this value can improve convergence of volumes at the cost of render time. However, the trade-off in scenes with other objects is that the volume will sample more without increasing costs elsewhere in the image and may improve your results.