# Volumes

## Overview ¶

Volumes allow you to store values for “voxels” (three dimensional pixels) in a space. This allows you to represent phenomena such as clouds, smoke, fire, as well as store simulation metadata such as velocity fields (store a velocity at each voxel, and use the velocity values to move (advect) other geometry), collision fields (store the 3D “hittable area” of an object as a sign distance field), and others.

Houdini supports two types of volume primitive at the geometry level, alongside other primitives such as polygons and NURBS surfaces. The two volume types are adapted for different uses, but Houdini’s tools attempt to work on them both generically where possible.

## Standard Houdini volumes ¶

A standard Houdini volume is a box with a position, size, and orientation, subdivided into a 3D grid of voxels, with a value stored in each voxel. This type is used in modeling (SOPs) and simulation (DOPs).

Different types of volumes store different types of information in the voxels:

Scalar field (density)

Stores a single numeric value at each point. This is useful to represent smoke, where the value at each point represents the density of the smoke at that location.

Sign distance field (SDF)

Used to represent fluids. Stores a number at each point representing the distance to the fluid’s surface, with the sign of the number (positive or negative) indicating whether the point is inside or outside the fluid.

Vector field

Stores a vector at each point. This is actually represented using three scalar fields (for example `Cd.r`, `Cd.g`, `Cd.b`) but Houdini knows to treat them as a single volume.

A common use for this type of a field is a velocity field for a gas simulation, which each point’s vector value represents the direction/velocity of the gas at that position.

(You can use the VDB Vector Merge node to combine three scalar VDB fields into a single vector VDB.)

## OpenVDB volumes ¶

An OpenVDB volume uses the OpenVDB library to represent a sparse volume very efficiently. A VDB volume uses essentially no memory for “empty” voxels (technically, voxels equal to the “background value”). This volume type is useful for modeling sparse volumes such as clouds and wispy smoke.

Because of the way this volume type is represented in memory, it does not require that you specify a box containing the volume; it can extend infinitely. Despite this, a VDB does define a 3D grid of voxels over the whole space.

OpenVDB volumes were added to Houdini in version 12.5.

You can write OpenVDB volumes to `bgeo` files and load them at render time using the Mantra delayed load procedural, just as with standard Houdini volumes/geometry. You can render standard Houdini volumes and OpenVDB volumes together and they will mix properly.

Surface nodes with “VDB” in their title operate on VDB volumes. You can convert geometry to VDB volumes using the VDB from polygons and VDB from particles nodes. You can create an empty VDB volume using the VDB node. Other “VDB” nodes let you edit VDB volumes.

Many SOPs that operate on standard Houdini volumes also work with VDB volumes. The node help will indicate if a volume node doesn’t work with VDB volumes.

VEX functions, HOM functions, and Hscript commands that operate on standard Houdini volumes should work with VDB volumes as well.

## Specifying volumes in group fields ¶

In a node that operates on a volume, you may have multiple volumes in the input geometry and want to select which volume a node will affect, using the node’s Group parameter.

If you have a volume primitive named `density` in the geometry, that is not a group. It’s just a primitive that has a `name` attribute set to `density`. You can’t type `density` in a group field to select it.

Instead, to select a single volume by name in the Group parameter, use the attribute matching syntax `@name=name` (for example, `@name=density`).

## Working with volumes in geometry networks ¶

To...Do this

See the outlines of standard volume containers in the view

Turn on display of hulls (click the Display Hulls icon in the display toolbar on the right side of the viewer pane).

You can also view the outline of volumes in wireframe mode.

Create a standard volume from existing geometry

• The FLIP Source SOP is designed to create source volumes for pyro effects and FLIP simulations, however you can use it to create “hollow” volumes from all kinds of geometry, including flat surfaces.

• The IsoOffset SOP can create a “solid” volume from an airtight surface. Use the Output type parameter to choose a volume type, and the Uniform Sampling Divs to set the resolution.

Create a VDB volume from existing geometry

Use the VDB from polygons or VDB from particles node.

Create an empty or uniform volume primitive

• For standard volumes, use the Volume SOP. The input to the Volume SOP allows you to specify the size of the volume container as the bounding box of the incoming geometry.

• For VDB volumes, use the VDB SOP.

Create a volume from an implicit function

Use the Iso Surface SOP and turn on Build Volume.

You can enter an expression in the Implicit function field to define the value of the volume at each voxel. For example, to create a uniform volume, enter `1`. To create a sphere shape, enter `1-(\$X*\$X + \$Y*\$Y + \$Z*\$Z)`.

Edit the values in a volume

Convert between standard volumes and VDB volumes

Use the Convert VDB SOP.

Create geometry from a standard volume

• The Convert Volume SOP will create a surface from the volume along isovalues.

• The Volume Surface SOP creates a triangular polygon surface by growing a surface from a random point inside the volume outward.

This method creates nice meshes but will only surface one component of a disconnected volume, and can fail to create a surface for some inputs. This node will fuse topological handle holes (for example, the handle on a coffee mug).

• The Convert SOP also does volume to poly conversion, however the Convert Volume SOP’s interface is more focused on volumes.

Create geometry from a VDB volume

Use the Convert VDB SOP.

Get the bounding box of the actual volume inside a container

Use the Scatter SOP to scatter points inside the volume, then wire the points to a Bound SOP.

Use volumes to edit other geometry

The Volume analysis, Volume Bound, and Volume Break SOPs let you create other geometry from volumes in various ways.

Use a volume primitive in nodes that take a volume file

Some nodes, such as the Volume Sample from File VOP, use volume files. You can grab “live” data from a SOP instead of from a file using the `op:` syntax, e.g. `op:/obj/geo1/volume1`.

Import data from a fluid or gas simulation as a volume primitive

## Merging volumes ¶

When using Volume Merge/Volume Mix, it’s a good idea to connect an empty volume (created using the Volume SOP) (of the size and resolution you want) to the first input, and then connect all the volumes you want to merge together into the second input (using a Merge SOP).

To set the size of the empty volume you are merging into to the combined size of the volume you're merging, wire the Merge node (with the volumes to merge) into the Volume SOP’s input (which sets the empty volume’s size using the bounding box of the input geometry) as well as the second input of the Volume Merge/Mix node:

The Merge/Mix Method parameter on the Volume Merge/Volume Mix nodes controls how the values in the two volumes are combined.

• To simply overlay two volumes, you will usually want to use “Maximum”. Using “Add” with normalized (0-1) volumes will give you values greater than 1.

• You can set the Volume Mix node’s Mix Method to “Difference” to carve the shape of one volume out of another.

## Special effects ¶

• You can use volume nodes to edit surface geometry by converting the geometry to a volume, editing it, and converting back to a surface. This is an excellent technique for smoothly merging solid models. It also lets you use powerful tools such as the Volume VOP and Volume Wrangle surface nodes to edit solid geometry with total programmatic control.

1. Convert the geometry to a volume using the IsoOffset node.

2. Use the volume editing nodes to edit the volume.

3. Convert the volume back to a surface using the Convert Volume node.

• The Attribute From Volume surface node lets you copy values from a volume onto nearby geometry. This is useful for special effects such as coloring objects as they move through a cloud.

# Geometry

## Understanding ¶

• Describes how Houdini represents geometry using details, primitives, points, vertices, and attributes.

## Modeling ¶

• In Houdini you can not only edit the parameters of a surface node, you can reselect the geometry the operation applies to.

## Terrain ¶

• How to use Houdini’s height field tools to generate realistic terrain.

• A heuristic workflow using the heightfield tools, based on experience generating realistic-looking terrain.

## Fracturing ¶

• How to break different types of materials.

## Clouds ¶

• How to create 2D and 3D cloud patterns using the Sky Field node.

## Next steps ¶

• The appearance editor mode of the data tree pane lets you edit various controls for object viewport/rendered appearance in one place.

## Guru level ¶

• You can mark a chain of compilable SOPs as a compiled block which can execute much faster in parallel.

• Many geometry (SOP) nodes allow you to use them in Python scripts to generate geometry programmatically.

• Some nodes use a library that gives a speed boost for floating-point operations but can make the output vary between different computers. You can control how much the library tries to guarantee reproducible results.