Caching the Rigid Body Simulation

Much of the work in creating a convincing rigid body simulation is the process of trial and error. You usually need to try out many different combinations of settings until you find the right effect. Caching the simulation lets you do this easily because it stores the current simulation frames into an action source, similar to how animation is plotted. As well, caching allows you to scrub the cursor back and forth in the timeline and get the correct state, and to play the simulation backwards.

Caching is useful for trying out several simulations with different parameters because you can create an action source for each for variation. You can cache the simulation using either the Standard or Live play mode. If you’re caching in Live mode, every change you make is updated and stored in the source file. However, when doing a final render of the scene and you are doing distributed rendering or using motion blur, it’s a good idea to use the Standard mode for caching.

When the simulation is cached, each frame that has been played is evaluated and stored. This means that you need to play through the whole simulation to cache each frame of it. The animation is stored as global transformation function curves (because rigid body dynamics are calculated in global space) that you can edit in the animation editor. The fcurves are raw curves, meaning that there is a key at every frame. You can also activate or deactivate individual fcurves (items) within the resulting action source.

When you are satisfied with the currently cached simulation, you can create an action source for it to keep with the model. You can cache one action source per model, which lets you import and export models with their cached simulation intact.

Once you have the simulation cached in an action source, you can load the action source onto a track in the animation mixer (thus creating an action clip) and use it like any other action clip. For example, you can load many simulation sources on tracks in the mixer, then play each one separately (solo), or mix the weights of two or more simulations together.

You can also delete or mute the rigid body dynamics operator to play the simulation as an animation in the mixer, or delete the simulation and reapply the action source back to the rigid bodies as animation.

 

Some deformation and topology edits can cause cycles with rigid body simulations, and therefore unpredictable behavior. The cyclic dependency happens because some geometry operators require the position of the rigid body to be computed, while the rigid body simulation requires the geometry of the rigid body in order to calculate collisions. The solution is to freeze the rigid body, or freeze its modeling.

For information in general about action sources in the animation mixer, see Actions [ Nonlinear Animation ].

To cache the simulation

1. Open the Simulation Time Control property editor for the simulation environment and select the Caching option.

2. Play the whole simulation to cache each frame of it, or play only the frames you want to cache. You can cache a source playing the simulation with either Standard or Live play mode.

When you first play the simulation, the source file is being cached so it takes a bit of time. However, once the source is cached, the playback is usually faster than if no source was cached.

3. Click the Save cache to mixer button to open the Store Environment Cache in Mixer dialog box.

4. In this dialog box, enter an Action Name for the action source that contains the cached simulation. This source is kept in the model’s Mixer node. Then if you export your model, the cached simulation is included with it.

5. If you like, you can select the Add Clip to Mixer option to apply the action source as an action clip in the model’s animation mixer.

6. In the explorer, click the Environment Cache icon to open its property editor.

 

7. In the Environment Cache property editor, select the file’s Storage type as Internal (saved with the scene) or as External (saved to a file).

 

- If you select Internal as the storage type, the source is saved as any other action source in the current model’s Sources > Animation folder.

- If you select any of the External options as the storage type, select a location and File name for the simulation source. This allows you to export the cached simulation in a separate file.

For information on external action sources, see Creating External Action Sources [ Nonlinear Animation ].

Locking the Cache

Once you have created a cache, you can lock it so that its contents can’t be resimulated once it is complete. This is particularly useful when you’re happy with the current state of the simulation and want to make sure that it won’t change. Locking a cache can be of great help before sending it to a render farm, for example.

To lock the cache

• Open the Simulation Time Control property editor for the simulation environment and select the Lock Cache option.

When this option is on, frames that have already been cached are not resimulated.



Autodesk Softimage v.7.5