Houdini 20.0 Dynamics

Caching simulations

On this page

Overview

Houdini caches simulated information in memory for quick playback. When Houdini runs out of space in memory for new cached frames, it will drop older cached frames and you can’t replay the whole simulation. Instead of caching simulations to your computer’s memory, you can also save the information to disk. Houdini provides several methods and nodes for caching simulation data and you have to differentiate between DOP and SOP networks.

SOP caching

Most simulations can also be performed inside SOP geometry nodes, instead of DOP networks. In the course of this migration, new cache techniques have been introduced. The most versatile method uses the File Cache SOP. This node lets you save and load data from any simulation type: it combines the functionality of the Geometry Render OUT and File SOP nodes. For certain types, e.g. rigid body dynamics or Vellum, you can use specialized I/O nodes like the RBD I/O SOP. These nodes are basically File Cache SOPs, but with extra inputs for constraints, proxy or collision geometry, and points. So, instead of using up to four File Cache SOPs for every data stream, you can add a single I/O node.

The mode of operation is almost identical for all cache nodes, but I/O nodes typically have some solver-specific options like Storage Type.

Note

Users, coming from DOP networks, might look for Cache Memory (MB) and Checkpoints. You can find both parameters on a solver node’s Setup and Advanced tabs. The Allow Caching To Disk option is not available with SOP simulations.

Explicit SOP disk caching

The File Cache SOP lets you assemble a path, where the output files are stored. Before you cache a simulation, the project should be saved with ⌃ Ctrl + S. By default, the file path is constructed from a series of variables in the Base Name and Base Folder input fields.

Token Meaning
$HIPNAME The project’s filename.
$OS Stands for the file cache node’s actual name (filecache1 by default).
$HIP Represents the path to the project’s .hip file.
geo The default folder for the cache files. If this directory doesn’t exist, it will be created. You can substitute geo through any other folder.

You can also choose an extension. For geometry, we recommend bgeo.sc and vdb for voxel data. If you don’t want to save your files to a different location, click the Open floating file chooser icon.

In the node’s Caching tab, go to the Sequence subpane, where you can adjust Start and End frames. By default, both fields are green, indicating that they're driven through expressions. These expressions read out the project’s start and end frames. For a custom range, right click Start/End/Inc and choose Delete Channels. Now you can enter your own values.

When you're ready to cache your simulation, press Save to Disk or Save to Disk in Background. For the latter option you must save the project. The button opens another instance of Houdini to cache the files through a the render manager. Houdini remains responsive and you can load already cached files to evaluate them. However, Save to Disk is faster.

Playing back from saved files

The Load From Disk option is turned on automatically for your convenience. To change this, open the Advanced tab and expand the Save subpane. Then, turn off Enable Load from Disk on Save.

The Caching tab’s Load subpane might be of particular interest for you, because you can choose what you want to load: All Geometry, Point Cloud, Packed Geometry, etc. For heavy scene, please also consider turning on Delay Load Geometry to reduce load times.

To play back the files, press the Play button in the timeline.

Timeline coloring

When working with simulations, the timeline (at the bottom of the main Houdini window) uses background colors to indicate the cached state of each frame.

Blue

Cached in memory.

Orange

Cached in memory, but out-of-date (you have changed a parameter, so the cache is no longer valid).

DOP caching

The Cache Memory (MB) parameter on the DOP Network OBJ controls how much memory to use for cached simulation frames. If you run out of RAM or if you want to save simulation data for further usage, open the Cache tab.

If you turn on Allow Caching To Disk, Houdini will write them as .sim files to the temporary directory, but only when the simulation exceeds the allocated amount of RAM. Scrubbing through these on-disk frames is slower than in-memory frames, but this allows you to cache an entire large simulation. You can control the saving of these files with parameters of the Cache tab.

Disk caching is disabled when simulating in the background unless you turn on Cache to Disk in Non-Interactive Sessions.

There are also times when you may want to explicitly save simulation files to disk:

  • When you only need to simulate the motion of objects (for example, rigid bodies) once, and then can use the saved motion to drive geometry.

  • When the simulation is “locked” and you want to just play it back from disk, avoiding re-simulating if parameters change.

You can use controls on the Output DOP or the Dynamics OUT render node to write out simulation files. You can use controls on the DOP Network OBJ to set up a simulation network to play back from cached files.

Explicit DOP disk caching

By default, when Allow Caching To Disk is on, Houdini saves on-disk cache files to the temporary directory. If these cached frames are invalidated, Houdini automatically deletes them from disk.

You can turn on Save Checkpoints to save the on-disk cache to a known location instead, with explicit control over how often and how many frames to cache. These files are not deleted if they're invalidated. However, checkpoints are useful for large simulations running on render farms. If the render fails for some reason at frame 50, you can change the start frame to 50, and Houdini will re-start the simulation from the previous checkpoint (for example, frame 45) instead of having to re-simulate from frame 1.

  1. Select the DOP Network OBJ.

  2. In the parameter editor, click the Cache tab and turn on Save Checkpoints.

  3. Check the Checkpoint File parameter, which controls where the sim files are written and the filename pattern of the .sim files. You must use $SF (internal simulation framestep number) instead of $F (global frame number) in the filename pattern.

  4. Set the Checkpoint Trail Length to control how many checkpoints Houdini saves at a time. If there are more checkpoints than this, Houdini will automatically delete the oldest one. This may be necessary for large simulations to prevent checkpoints from filling up the disk.

  5. Set the Checkpoint Interval to control how often Houdini saves checkpoint files. For example, setting this to 5 will save every fifth frame.

Baking out sim files

The Output DOP at the end of the simulation network inside the DOP Network OBJ has controls for writing out simulation files. These files are independent of the cache. You can keep .sim files between runs of Houdini, and move them between computers.

  1. On the Network Editor’s obj level, double click the DOP Network node to dive into it. There, select the Output node.

  2. In the parameter editor, you set the Start and End frames to simulate. By default, the parameters are controlled through expressions to automatically use the project’s start and end frames. If you want to change these values, right click the Start/End/Inc parameter and choose Delete Channels from the menu.

  3. Check the Output file parameter, which controls where the sim files are written and the filename pattern of the .sim files.

    You can use a .sim.gz (GZIP) or .sim.sc (Blosc) extension to have Houdini compress the files. This is slower but saves disk space.

  4. Click either Save to Disk or Save to Disk in Background.

    Saving in the background launches a new copy of Houdini in the background to run the simulation. You must save the .hip file before you use this option. You can monitor the background task using the render manager.

You can also use the Dynamics OUT render node to write out sim files. The render node is useful if you need to generate simulation data as part of a rendering dependency path. Also, because the render driver is not part of the simulation itself, changing its parameters will not cause the simulation to recook.

Playing back from saved sim files

Once you've baked out simulation files, you can set up a DOP network to never cook and only play back the contents of the simulation files.

  1. Select the DOP Network OBJ.

  2. In the parameter editor, turn on Playback Simulation and set the filename pattern for the .sim files to use.

    You may want to make this a channel reference to the filename parameter on the node saving out the files, so you don’t have to keep the two parameters in sync manually. Right click the filename parameter on the output node and choose Copy Parameter. Then, on the DOP network node, right click the playback filename field and choose Paste copied relative reference.

Timeline coloring

When working with simulations, the timeline (at the bottom of the main Houdini window) uses background colors to indicate the cached state of each frame.

Blue

Cached in memory.

Purple

Cached to a sim file.

Orange

Cached in memory but out-of-date (you have changed a parameter, so the cache is no longer valid).

Dynamics

Learning dynamics

Colliding objects

Simulation types

Next steps