Use particle disk caching
 
 
 

Create a particle disk cache

After you have created a particle disk cache, Maya uses the cached particle data, no matter what changes you make to your scene, until you explicitly tell it not to.

For example, if you cache the scene, then apply a gravity field to a particle object, you will not see any effect from that field because Maya is using the cached particle motion. To see the effect, you must turn off Use Particle Disk Cache (see Editing particle disk cache settings).

However, if you make a change that does not alter per-particle attributes, such as changing the render type from blobby to streak, you will see the change without turning off Use Particle Disk Cache.

TipBefore creating a particle disk cache, make sure the particle shape name is unique from other particle shape names. Since the disk cache file will use the particle shape name, you won't get the correct results when creating the disk cache if the same name is used for other particle shapes.

We suggest you name your scene before creating a particle disk cache; otherwise, Maya saves the particles in a directory named untitled.

To create a particle disk cache

  1. Select Solvers > Create Particle Disk Cache.

    Maya plays through the scene once using the current time slider playback range and writes out cache files. Maya does not re-draw the screen during this playback. If you want to cache a different range, you can either change the current range of your time slider or turn on Use render settings range (see Use Render Settings Range).

    Maya must play the scene through once to create the cache. If you don’t want to wait through the playback, you can interrupt it by pressing the Esc key, but the cache won’t be created.

  2. After creating the cache, save your scene so any settings you made to the Particle Render Cache Option window get saved with the scene. Otherwise Maya might not know to look for your cache or might not be able to find it.

    When you create the cache in the above manner, Maya creates a cache for all particles in the scene. If you want to cache some particles objects and not others, see Caching a single particle object.

    NoteBe sure to save your scene after creating the cache. Otherwise, Maya won’t know about the cache when batch rendering.

Setting particle disk cache options

You can set the following particle disk cache options before creating the cache. These options affect all subsequent caching operations.

To set the particle disk cache options:

  1. Select Solvers > Create Particle Disk Cache > .
  2. Set the following options:

Editing particle disk cache settings

To edit particle disk cache settings

  1. Select Solvers > Edit Oversampling or Cache Settings.

    The Attribute Editor for the dynGlobals node is displayed.

  2. In the Particle Disk Cache section, set the settings. See Particle Disk Cache.
    NoteBe sure to save your scene after editing any of these values. Otherwise, Maya won’t know about them when batch rendering.

Play back different caches

You can use particle disk caching to create different caches for the same scene. This lets you create and quickly play back variations on a scene.

To create and play back different caches

  1. Create your scene and name it.
  2. Select Solvers > Create Particle Disk Cache > .
  3. Enter a name for the Cache Directory or leave the default name, which is the scene name.
  4. Click Create to create the cache.
  5. Make any changes to your particles.
  6. Select Solvers > Create Particle Disk Cache > .
  7. Enter a new name for the Cache Directory and click Create.
  8. Continue this process to create as many caches as you want.
  9. To choose a cache for playback, select Solvers > Edit Oversampling or Cache Settings, and enter the cache name in the Cache Directory box.
  10. Press the play button to see the scene play back from the specified cache.

Re-create the cache

Once you have created the cache, Maya uses that cache until you tell it not to. It ignores any changes in emission, forces, etc. on that particle object.

If you change something in the scene that alters per-particle attributes, you must re-create your cache in order to get correct renders. Maya writes out the disk cache only when you select Create Particle Disk Cache. That menu item does not turn on a “caching state.” This is an important difference between memory caching and disk caching. Maya does not automatically update or re-create your disk cache.

To re-create your cache

  1. Select Solvers > Create Particle Disk Cache.

You don’t need to re-create the cache if you make a change that does not alter per-particle attributes. For example, you could change a particle shape’s render type from blobby to cloud, save the file, and re-render. Or you could change keyframed colorRed/colorBlue/colorGreen attributes. In both these examples, you would not need to re-create the cache because the attributes involved are not per-particle.

Be careful, however, because attributes such as colorRed can indirectly affect per-particle attributes. In the previous examples, if you had a per-particle expression on some particle object that made use of the render type or colorRed as an input, the results of that expression would be affected, so you would need to re-create the cache.

Particle disk cache files

Maya saves cache files for each particle shape for each frame. If oversampling is turned on, it saves multiple disk caches at different times within a frame depending on the oversampling rate.These binary files have the extension .pdc, which stands for particle data cache. Maya uses the dynExport command to write these files.

You can’t read .pdc files. If you want to output particle data files you can read, see the online documentation in the dynExport command for information on outputting .pda and .pdb files, and also the ExploreMe/particlesreadpdb directory on the Maya DVD. See Appendix Use the PDC File Format for information on writing your own reader.

Deleting cache files

There is no way to delete cache files or directories from within Maya. Delete them using your operating system.

Caching tips

Ramps

If you are animating per-particle rendering attributes by ramps, and you change those ramps, you’ll see the change in playback even if the cache is enabled. This also applies to changes in hardware display/rendering attributes such as pointSize. To avoid any confusion, turn off the Use Particle Disk Cache attribute before you make changes to your scene, and re-create your cache just before you render.

If you are animating any attribute with expressions, or animating rampPosition, rampVelocity, or rampAcceleration with ramps, any changes you make to those expressions or ramps will not be visible in playback as long as the cache is enabled. Turn off Use Particle Disk Cache.

Particle collisions with rigid bodies

If you have a rigid body being driven by particle collisions, and you disk-cache the particles, the rigid bodies will no longer evaluate correctly. In effect, the caching takes away the dynamic properties that allow the rigid bodies to evaluate and they can’t detect the collisions any more. To cache such a scene, first bake out the rigid bodies (see Baking rigid bodies below), then disk-cache the particles. The same limitation and same workaround apply to in-memory caching as well.

Baking rigid bodies

The particle disk cache always applies to particles only. It does not apply to rigid bodies. In most cases, rigid bodies can compute their positions without needing to do a run-up. If you encounter any problems in this area, you can resolve them by baking out your rigid bodies, using the bakeResults command.

For example, to bake out rigidBody1 for frames 1 to 100, do this:

bakeResults -t "1:100" -simulation true rigidBody1;

You can’t use the bakeResults command to bake out particle motion. It bakes out animation channels, such as translateX/Y/Z, not particle positions.

Even if unbaked rigid bodies do cause a run-up, the run-up will go faster if your particles are cached, because the particles are loaded from the disk cache instead of being recomputed.

Caching a sequence in two parts

You may find it necessary to cache two parts of a sequence separately. For example, if you cache frames 1 to 45 in one place, and frames 46 to 90 in another place, you must be sure that the two caches “line up” so there is no discontinuity from 45 to 46.

Make sure that the animation and dynamics the first time you cache are consistent with the second. Make sure you didn’t add or change anything, or have something changed for you.

In particular, if you have expressions that use the MEL rand() function, you must make sure your expressions are properly reseeded (see Reproduce randomness Reproduce randomness in the MEL and Expressions guide).

Caching a single particle object

Using Solvers > Create Particle Disk Cache caches all particle objects in the scene. You can cache a specified object from the command line using the dynExport command (see the online Command documentation for information on the dynExport command).

You can also get this same result by using your operating system to delete the cache files for all objects you don’t want read from the cache.

Caching only certain attributes

By default, all attributes are cached. However, you can cache only certain attributes using the dynExport command (see the online Command documentation for information on the dynExport command).