Volumetric rendering is an approach in mantra that allows high quality, integrated rendering of volume-like effects such as: smoke, clouds, spray, and fire.
Scenes that are particularly suited to rendering with mantra volumes include detailed “hero” clouds, smoke, or fire as well as fields of instanced clouds, smoke, or fire. Scenes with a single uniform fog, for example, may not be suitable for volumetric rendering.
By default, Mantra dices volume primitives for micropolygon rendering similar to surfaces, by using a view-dependent dicing metric. Dicing responds to the same shading quality controls that surface dicing uses.
The sampling of volumes is performed by ray marching for each pixel sample, using the Volume Step Size as the z-spacing of samples. Raytracing shades every point along the volume sample raymarch, similar to shading every pixel sample for surfaces in raytracing.
Volumetric rendering from a primitive
Create an object.
At the geometry level of the object create an
IsoOffset node and attach it to the geometry.
In the parameter editor of the
IsoOffset node, set the Output Type to SDF Volume, turn on the Invert Sign checkbox, and turn off the Laser Scan checkbox. You can modify the Divisions and Iso Divisions parameters to get a more detailed volume.
Create a
Material in the
SHOP network that consists of a VEX Volume Cloud shader and assign it to the object.
For more information on creating and assigning materials, see the
Materials help.
Set up lights. If you want shadows you must set the Shadow Type parameter to either Depth Map Shadows or Ray-Traced Shadows on the Shadow tab of the light. Using depth map shadows is much faster than ray traced shadows.
For more information on setting up Lights see the
Lights and Cameras help.
Render your scene and you will see smoke.
Note
You may want to tweak the volume step size, shadow map, quality, and volume primitive divisions.
Volumetric rendering can also be done automatically with a fluid solver, as fluids have default shaders. For more information see
Fluid Simulation.
Controlling quality and performance of volumetric rendering for surfaces
Volumetric rendering uses ray marching to step through volumes. Ray marching generates shading points in the volume by uniformly stepping along rays for each pixel in an image.
| To... | Do this |
|---|---|
| Change the quality of the volume ray marching | Increasing the pixel samples produces more ray marches within that pixel leading to higher quality. Using more pixel samples also improves the antialiasing and motion blur quality for the volume. This value can be modified in the Pixel Samples field on the Sampling sub-tab of the Properties tab in the parameter editor of the render node. |
| Improve quality and decrease performance | Decrease the Volume Step Size to produce more samples in the volume interior. This field can be edited on the Sampling sub-tab of the Properties tab in the parameter editor of the render node. You can also change the Shadow Step Size to adjust the quality of shadows. |
Generally, it is better to decrease the volume step size than to increase the pixel samples because a smaller volume step size will result in more accurate renders.
This example shows a render that uses 2×2 Pixel Samples and a Volume Step Size of 0.25.
This example shows the same scene rendered with 4×4 Pixel Samples and a Volume Step Size of 1. The detail in the shadow has been lost and the volume is more transparent. However, the quality level is approximately the same.
Controlling quality and performance of volumetric rendering for shadows
Shadow map generation uses the samples and shadow step size to control the quality and performance in exactly the same way they are used for on surfaces. Since volumes often cast soft shadows and diffuse shadows, it is often possible to use low-resolution deep shadow maps when rendering volumes, which leads to quicker render times. These parameters can all be specified on the Shadow tab of a Houdini light.
Note
The shadow map resolution can be changed on the Shadow tab of a light node.
Rendering metaballs
Metaballs can be rendered as a volume in mantra. Metaball rendering can be enabled by turning on the Metaballs as Volume checkbox on the Geometry sub-tab of the Render tab of a Geometry object. Any point attributes on the metaballs will be interpolated to the shading position in the same manner that point attributes are interpolated for metaball surfaces.
Note
You need to apply a surface shader that takes into account the volume primitives, such as basic smoke.
This examples shows metaballs rendered as a volume using randomized point color attributes.
Troubleshooting
If your scene renders with artifacts, try using raytracing (non-micropolygon) mode for the shadow map generation.
Click the
gear menu on a light source and select Edit Rendering Parameters from the drop-down menu.
Add the Render Engine property. For more information see the Edit Parameter Interface help.
Switch it to Raytracing.
Repeat steps 1-3 for all light sources that generate shadow maps.
Tips and tricks
Many overlapping volumes are more work for mantra to render efficiently (like large displacement bounds on surfaces).
It’s easiest to render internal motion using velocity motion blur (as opposed to deformation motion blur).
Shadow maps can be problematic with motion blur. When you're rendering the shadow map, make sure motion blur is off (this is the default in Houdini 9.5 and later).
There are HDK examples showing how to create custom volume objects. It’s possible to specify acceleration structures to skip empty volumes (or sample some areas less).