OpenVDB
Introduction
Both gases and liquids are fluids. LightWave 2018 introduced us to the importation of existing OpenVDB simulations, LightWave 2019 presented a robust framework based upon the industry-standard OpenVDB toolset, and LightWave 2020 expands with new tools and workflows. This toolset was developed by DreamWorks Animation, primarily by Ken Museth, Peter Cucka, Mihai Aldén, and David Hill, for use in volumetric applications typically encountered in feature film and expands on this foundation providing backward compatibility with Lightwave's existing particle simulation tools - ParticleFX and Flocking - while also introducing a new workflow for entirely VDB-based simulations.
In most cases, gases are handled by the OpenVDB Primitive type introduced in 2018 with a dedicated node editor. This provides fog-like raymarched volumetric rendering of thin particles such as smoke and fire.
Fluids, on the other hand, will mostly be generated as polygonal surfaces - called Iso Surfaces - using the OpenVDB Evaluator found in the Object Properties Object Replacement dropdown menu.
The key element in OpenVDB is the grid, more precisely "the efficient storage and manipulation of sparse volumetric data discretized on three-dimensional grids." Think of grids as an object's bounding box that can be subdivided into smaller cells where something exists (such as a surface, points, particles…) while ignoring the empty cells, hence the "sparse" part of the description.
These cells are Voxels and act much like pixels in an image, but representing 3D volumetric shapes. The smaller the voxel size, the more detailed the object will be.
The beauty behind this system is that it entirely ignores empty cells decreasing memory and disk usage while making the rendering of volumes much faster.
This new feature gives the user the power to create volumes from meshes and meshes from volumes
OpenVDB Evaluator
To create your own OpenVDB object, you need to start with a source object and a null with the OpenVDB Evaluator Object Replacement added. OpenVDB objects can be made from meshes, primitives and even other volumetrics.
Once you have your target mesh and null to direct it to, open the node editor by clicking on the Properties button next to the OpenVDB Evaluator entry. The destination node:
contains three entries. A scalar-based grid input, an OpenVDB-specific Particle System input, and a vector-based velocity grid input. The scalar grid is the one you'll use most often for fixed shapes. The new Particle System input gives you the ability to output a particle system from the OpenVDB Evaluator for further work downstream. If motion blur is enabled and there is a velocity grid, a deformer will be added to the object modifiers list allowing for subframe evaluation of the grid using the velocity input.
The OpenVDB Blur deformer cannot be interacted with by the user. It has no UI, cannot be added or deleted except automatically by Layout
Double-clicking on the destination node will open its settings window
Iso - The iso value is considered to be the zero-crossing of the grid's field of values. This zero-crossing is where polygons are constructed
Adaptive - Values above zero will consolidate small voxel size polygons into larger polygons as flatness allows
Invert - Fog volumes can be input, but due to the representational difference between them (unsigned ) and SDF ( signed) volumes, the polygons appear backward. Checking Invert will flip the polygons for that case. Additionally, you will need to move the Iso surface above 0
Points Only - Useful for outputting a particle system still as particles for use with other systems in Layout, like Flocking, Instancing, HyperVoxels, etc.
Static Mesh - Stops frame-based re-evaluation of a resulting OpenVDB mesh
RAM Cache - Caches the Grid input to RAM, up to the Max MB setting. If the cache exceeds this amount caching is released, starting with the frame furthest from the current frame
RAM Cache Max MB - The total RAM cache for the scene
RAM Cache Size - This field should show the current size of the RAM cache, and currently doesn't. The error will be corrected.
Common
OpenVDB nodes may have the following common settings:
Voxel Size - Size of the voxel grid in meters (LightWave supports uniform grids); the size of the voxel "blocks" that will make up your object
Inner Bandwidth - Inner Bandwidth for level set in voxels
Outer Bandwidth - Outer Bandwidth for level set in voxels. For fog volumes, this defines the "softness" until maximum density is reached.
Fill Interior - Toggle for whether the volume will be solid when cut into or just a shell - like polygons are. Turning on Fill Interior with a Fog Volume will soften the outside of the fog
Coordinate System - How the voxel will be transformed. There are three choices
Local - No transform
World - Transform into world space
Parent - Use the parent item's space
Grid Name - the base name of
savedgrid.vdb
files. Files will be appended with the frame number and written with temperature, density, and velocity grids
Solid Volumes from Meshes and other Scene Items
Creating a volume this way requires a target mesh, primitive shape or Particle emitter that needs to be in the scene. It can be out of camera view, hidden from render and hidden in OpenGL and the Object Replacement will still work. To create a volume from this item requires adding a null and using the Object Replacement entry OpenVDB Evaluator. Clicking Properties for it will bring up a Node Editor window.
Mesh To Volume
In the OpenVDB nodes group, Mesh To Volume will be the node to convert your mesh objects into volumes. There are two choices for conversion, Fog Volume will convert a mesh into a volumetric fog, much like the image at the top of this section, but you need to use an OpenVDB primitive. The second option is Level Set, which creates a volumetric mesh object. The Voxel Size setting will determine the resolution of your volumetric object. For the Logo Rezzing Up example, a Scalar Constant node was used with an envelope that went from the default 1 down to 0.0025 to create the increasing resolution of the volume.
Particle Radius is where you set the size of individual particles if you will be outputting a particle system from this node.
The new Attributes tab, added in 2020, is where you can transfer details like vertex maps or surfacing information from the original mesh to your OpenVDB object.
Surfaces will all be added. You cannot just choose one.
Shape To Volume
Will create a volume from LightWave primitive objects.
Fog To LevelSet
Converts a Fog grid to a Level Set mesh object. A fog grid can be imported using the OpenVDB Info node. Double-clicking the node brings up its window with Iso setting and Normalize toggle.
From Particles
The Morphology tab includes elements that are found in the Filter node that can be applied directly, without needing a discrete Filter node.
New to 2020. There is now a Particle System output to send particles directly to the Editor Input. You can choose to represent particles as individual spheres or a trail (of connected spheres). When you select Trail, a **Trail Resolution ** setting becomes available. Higher values mean more trail particles and might be needed for high-velocity trails.
This node will create a volumetric object from a stream of particles created using the FX Emitter or the Scatter or Solver nodes here. You have the option to either create sphere shapes or a trail per particle derived from their position, radius, and velocity. Each trail is generated as CSG unions of sphere instances with a decreasing radius.
Particle System - A dropdown for choosing the specific particle system you want to use. Using the Input ghosts this control
There are two tabs next:
Surface - Details how the particles look:
Particle Count - A readout of attached particle system particle count
Space - Choose whether your particles are situated in Local, Parent or World Space
Particle Type - Choice between Sphere and Trail. Sphere will create distinct bubbles whereas Trail will attempt to use particle velocity to create a trail of diminishing size. Each trail is generated as CSG unions of sphere instances with a decreasing radius
Trail Resolution - Only available when the Trail Particle Type is chosen. The default of 1.0 trails off " normally". Less than 1.0 means fewer trail particles and separation might be noticeable. More than 1.0 means more trail particles are created. Higher trail speeds might need more particles to stay stream-like so separation doesn't show
Voxel Size - Size of the Voxel for the particles. Voxels sizes in a network should be the same, especially combining or collisions between VDB grids
Iso Surface - Iso sizes in a network can be different but the editor input node will create the final meshing
Morphology - Operators so additional nodes are not needed
Dilation - Dilate the grid along its normals making it bigger
Closing - Dilate the grid to close holes then erode closing openings
Smoothing - Gaussian smoothing
Gaseous Volumes from Scene items
Gas Solver
LightWave's gas solver uses the Stam's stable fluids method to advect density and temperatures. Both the density and the temperature affect the fluid's velocity. Heavy smoke tends to fall downwards due to gravity while hot gases tend to rise due to buoyancy. We use a simple model to account for these effects by defining external forces that are directly proportional to the density and the temperature.
buoyancy = (-densityscale * density * Vec3f(0, 1, 0)) + (temperaturescale * temperature * Vec3f(0, 1, 0));
External forces can be added on the Force Grid input. This input accounts for external forces like gravity, wind, turbulence and merely is added onto the end of the momentum equation.
Temperature Tab
Ambient Temperature - Ambient air temperature
Clamp Temperature - Clamps the temperature to the minimum value set below (otherwise the gas cools to the point where it falls like dry ice)
Min - The minimum temperature (in Celsius) for the gas to fall to
Normalize Temperature Grid - Outputs the temperature grid as a scale between 0 and 1, rather than, say, 60 and 900
Fuel Temperature - Fuel temperature as it is emitted
Gas Density - Density of emitted smoke from the fuel grid
Fuel Velocity - Velocity of emitted smoke and heat from the fuel grid
Density Scale - Scale of the downward pull on dense smoke
Buoyancy Scale - Scale of the temperature gradient pulling smoke upward
Cooling Scale - Scales the cooling rate
Dissipation - The amount of density that falls off over each iteration so that the gas thins over time
Advection Tab
Domain Tab
The Min and Max domain fields are for setting the minimum and maximum extents (corners) of the simulation's domain. Cache Tab
To Fog Volume
Converts an SDF grid (signed) to a fog volume (unsigned) with a filled interior. There are no options. Tools
You can manipulate OpenVDB volumes with the following included tools. Advect
Advect a Signed SDF grid with a velocity grid. Requires a Velocity Grid vector to give movement and direction.
Advect Points
This node will advect the points in a particle system along a velocity field. The first thing you need is a particle system to use. Node inputs are:
In the node's panel, the controls are as follows:
Analysis
This node presents various grid manipulations. Depending on the input grid type and the operation the output grid type will vary. Once an input is connected and the grid type is known the list of available operations will be collapsed to only show appropriate choices. Finally, if you change the operation the grid output will disconnect (ie scalar to vector).
There is also a Scale input for further adjustment.
CSG
Takes the Result from two SDF shapes and combines them in the fashion that should be familiar by now -
The velocity of the input grids will be reconstructed and output. Combine
Combines grids using scalar operations.
Filter
This node adjusts the inner bandwidth of a volumetric signed distance field represented by a VDB volume
Filters the level set grid:
Level Set Morph
You can morph between polygonal objects. It's not easy because you have to have the same point and poly count, and those points and polygons need to be in the same order; it's a tough job. Now, we have given LightWave the power to do the same using OpenVDB, the results can be very impressive.
You will need to freeze subpatched objects as they are not seen by OpenVDB
In a scene, have two polygonal objects and a null. The point and polygon counts don't have to match, or even be close. In the example above, we are going from the Utah teapot with 1,506 polygons, to the Stanford bunny object with roughly 70,000. Use the Object Replacement > OpenVDB Evaluator entry to convert the two objects to OpenVDB (make sure that their Voxel Size fields match) Level Sets. Pipe the Grid outputs from these nodes into the new Level Set Morph node and from that into the destination Grid node.
Morphing between objects involves the nodes we've already outlined. Morphing from one surface into another requires the two surfaces to be changed as well. To do so, in the Surface Editor, pick your morphing null and edit its surface. Double click on the surface name to open the node editor and add:
The above node tree will synchronize your surface morphing at the same time as the geometry
The first four controls (Spatial, Spatial Normalize, Temporal, and Temporal Normalize) are graded in terms of rapidity and quality. Change up from the first only if it is posing problems with how the Morph is playing out.
Noise
Add the Bump output from an image or a 3D Texture to this node and pipe the output through.
OpenVDB Info
The values for the Fuel channel of a VDB sequence
You can pipe a Level Set or Fog grid into this node and see the values contained within the file, but this node becomes more useful when you load a vdb file directly in the node. You can see info from whatever channels the vdb file contains. Partio Node
Partio is an open-source C++ library, created by the Walt Disney Animations Studio, for reading, writing and manipulating a variety of standard particle formats (GEO, BGEO, PTC, PDB, PDA). LightWave cannot support the BGEO format right now, but Houdini can save in the older HClassic format that LightWave will understand. To save in HClassic format, just replace the file extension in Houdini.
The Partio node is simple in that it has one output and no inputs. Double-clicking on the node shows more depth:
Attributes list
Using the Houdini "vocabulary" here. If you have particles from a different source, the names may be different. The fields are fairly self-explanatory with name, type, and depth. A Float 3 is three scalars, a color for instance. A Float 1 is a simple scalar.
The Partio node has a single output - Particle System. To see these outputs, add an Additional > ParticleInfo node.
Because the outputs are dynamically created, if you are not seeing the outputs you expect, make sure that:
Once you have exported a stream of HClassic files, you can import them into LightWave using the Partio node. To do so, add a null to an empty scene. Make the null an OpenVDB Evaluator using the Object Replacement dropdown menu. Hit the P button to edit the Evaluator's nodes. Add the Partio node, but you won't see anything until you have chosen from the following
You can also use LightWave's own Volumetric objects. Add another null called "vol". Set the vol null Primitive Type to Volumetric. Use an OpenVDB Evaluator Object Replacement in the Partio's Object Properties window. In the Node Editor, add a Partio node and bring in your Houdini HClassic files. Set the Partio node Target to the vol null.
Hook the Partio node directly to the Destination OpenVDB node. This will output a particle system. Add a new null labeled "vol" and make it a Volumetric object. Set the source item here to vol.
Resample
Resample input grid to new voxelsize to output grid.
Saver
Pipe a grid into here and the frame or sequence is saved as VDB files upon clicking the Save button.
To load files saved this way, use the OpenVDB Info node to choose the VDB file and its channel saved.
Scatter
Scatter creates particles on the input grid. The particle system constructed belongs to the scatter target item. Particles can be scattered on or in both SDF and fog volumes.
Depending on the scatter mode chosen:
Creating bubbles inside a VDB toroid is simple with the Scatter node. The Filter node has been used here in Erode mode to ensure that the bubbles are created inside the toroid volume and not at the boundary. Solver
A particle solver that uses a particle system to initialize a temporal PIC/FLIP feedback loop. Particles from the particle system are input as they are born. Then are advected by the integrator using the gravity over the frame substeps. PIC (Particle In Cell) produces smoother motions, and FLIP (FLuid Implicit Particles) is splashier. The two methods can be combined.
The Navier-Stokes equations that the PIC/FLIP system uses do not dictate position but velocity. The vectors contained are not coordinates but velocities. PIC / FLIP is an advection equation, which is how the particles in these objects move within velocity fields.
Particles In Cells (PIC) works by evaluating particles as groups of particles in cells (like voxels)
FLIP stands for FLuid-Implicit Particles and uses a grid rather than particles. Grid-based methods were great for large ocean effects, but not fine detail close up visual effects work. Things can look globby and unrealistic at a small scale (thin fluids). Inputs
Outputs
The Solver is time-based so scrubbing the scene will break it, particularly going backward. Create previews to see a smooth animation if your scene is too heavy. Vector Merge and Split
New to LightWave 2020 is a pair of nodes to split level sets into three separate dimensions for further manipulation. The Vector Split node takes an incoming OpenVDB grid and splits it into X, Y and Z channels. There is no options panel.
The Vector Merge node will create a vector-valued VDB volume using the values of corresponding voxels from up to three scalar VDBs as the vector components. The scalar VDBs must have the same voxel size and transform; if they do not, use the Resample node to resample two of the VDBs to match the third.
This node offers the following types of operation:
Velocity
This node will construct a velocity grid for motion blur use.
You can use an envelope or a texture map to adjust the velocity grid over time for more control Visualize
Additional Destination node to help visualize VDB networks. You can choose any combination of the three choices - Values, Voxels, and Extent. When this node uses a Velocity Grid output as its input, the Vector Options dropdown menu becomes available.
OpenVDB Examples
Bullet and FiberFX Fracture
© Copyright 1990-2024 LightWave Digital. All rights reserved. Found a Bug in the documentation or want to make a Feature Request? Use the feedback agent in LightWave.