Writing and Reading Cache Files in the ICE Tree

You can use the Cache on File node in the ICE tree to write the simulation or animation data stored on an object, including its ICE attribute information, to a cache file. You can also use this node to read (load) attribute information from a cache file, as well as blend cache file sequences with each other, merge cache file sequences together, and copy cache file sequences from one location to another.

The cache file that is created is the same type as the one created when plotting the geometry’s simulation or animation to a cache file using the Tools > Plot > Write Geometry to Cache command. See Plotting Simulation or Animation Data into Cache Files for information. This means that you can use the resulting cache file in either the ICE tree or the animation mixer.

Writing to a Cache File in the ICE Tree

The Cache on File node lets you write simulation or animation data on the selected object. It stores the values at the evaluation point and outputs these values from that point on, until you click the Update icon. If the values change over time, it stores only one frame, and evaluates the next one. This node optimizes part of a graph so it does not evaluate at every frame.

To write to a cache file

1. Select an object or point cloud whose simulation you want to cache.

 

If you want to create cache files for multiple objects, use the Plot > Write Geometry to Cache command as described in Plotting Simulation or Animation Data into Cache Files.

2. Open the ICE Tree view.

3. Click the Tool tab in the preset manager on the left side of the ICE Tree.

4. Select the Cache on File node from the Data Access group, and drag it into the graph area.

5. Plug its Execute output into a port on the ICETree node (below the other nodes that are plugged into it).

6. By default, the Current Frame node is plugged into the Frame port of the Cache on File node. This port specifies the frame number to be used to resolve the file name. You could plug another node or compound in here to drive the frames used for the cache, such as the Frame Cycle Control compound.

 

7. In the Cache on File property editor, select Save to File from the File Mode list. This takes the data at this level and caches it into file.

8. Select a Template Path from the list for the cache file. The Path is automatically selected from the defaults set up in the Simulation Preferences property editor.

This information here is taken from the File Cache Path Template preferences you have set up in the Simulation Preferences—see Setting the Default Paths for Cache Files. You can view or change the paths you have set up there.

If you select Alternative Path, you can choose it from a browser—click the (...) button beside the text box to open the browser.

9. Enter a name in the text box beside the Template Path—this is the file (version) name.

 

10. On the General Controls tab, use the Attribute List text box to enter any ICE attributes you want to include that are in addition to the required attributes that are automatically included in the cache file (see ICE Attributes below).

11. Play through the simulation.

The frames are cached into the file in the path that you’ve specified.

12. Now you can read the cache file in this ICE tree or in the ICE tree for another object (see Reading a Cache File in the ICE Tree) or load it into the animation mixer as a clip on a track (see Loading the Cache File in the Animation Mixer).

ICE Attributes

On the General Controls tab in the Cache on File property editor, you can specify which attributes you want to write into the cache file.

If you don’t specify anything, Softimage automatically makes sure that all required attributes are included. These are the attributes which are used in the ICE tree and in the render tree for rendering (such as those being used by an attribute shader in a render tree).

Each object type has specific attributes: for example, NURBS curves, surfaces, polygon meshes, and hair only have the PointPosition attribute to include. Point clouds, however, have many attributes including ones related to rendering. Their attributes include: Color, Force, Mass, Orientation, PointPosition, PointVelocity, Scale, Shape, ShapeInstanceTime, SimulatedFrameFraction, Size, SpriteAngle, StateID, StateTransitionTime, StrandOrientation, StrandPosition, StrandSize, and StrandVelocity.

Read-only attributes, such as PointCount on a polygon mesh, are not written to the cache file.

If you want to include any attributes in addition to the required ones, you can enter their names in the Attribute List text box on the tab. Separate each attribute name by a comma.

Local versus Global Space

If you’re using the PC2 file format, the data is cached on the object’s global point positions; however, the ICECache file format caches the object’s data in its local space instead of global space. The object’s ICE attributes are cached as they are, therefore point position contains local space information. This means that if the object has a simulated deformation, but is also transforming (such as bouncing across the floor), only the object’s point deformation is cached, but not its transformation.

So how do you cache global space positions for geometry?

Here’s are some ways:

• You can create an attribute, such as GlobalPointPosition, to store the global point position and cache that. When you load the cache file, you can then use a Set Data node with PointPosition be equal to GlobalPointPosition.

• You can store a cache and then plot the fcurves for geometries in order to re-create the animation outside of the scene file.

• You can create an empty primitive point cloud and use a Clone node in the ICE tree to clone all particles into that point cloud, then cache that cloud.

Reading a Cache File in the ICE Tree

Once you have created a cache file, you can use the Cache on File node to read it in the ICE tree. You can apply the cache file to the same object for which you created the cache file, or to another object.

If you’re loading a cache file onto a different object, the number of points on this object must match the number of points that were on the object whose data was cached.

 

If you can’t remember the number of points in the geometry used for the cache file, choose the Tools > Plot > Load Geometry Cache command with nothing selected and it creates a point cloud reflecting the same geometry and number of points you used.

To read a cache file in the ICE tree

1. Select the object to which you want to apply the cache file.

2. Open the ICE Tree view.

3. Click the Tool tab in the preset manager on the left side of the ICE Tree.

4. Select the Cache on File node from the Data Access group, and drag it into the graph area.

5. Plug its Execute output into a port on the ICETree node.

6. By default, the Current Frame node is plugged into the Frame port of the Cache on File node. This port specifies the frame number to be used to resolve the file name. You could plug another node or compound in here to drive the cache frames played, such as the Frame Cycle Control compound.

7. In the Cache on File property editor, select Read from File, which loads the data from the file you select and inserts it at this point in the tree.

8. If you want to blend the results of multiple cache files (see below), get a Cache on File node for each of them, plug each of them into the ICETree node in the order you want them evaluated, and then plug the same Current Frame node into each of their Frame ports.

You can also modify the cache file data by plugging in nodes and compounds as you would in a normal ICE tree.

9. Play back the scene to see the simulation in the cache files play back on the selected object.

Select the Mute option on the General Controls tab in the Cache on File property editor to temporarily disable the playback of the cache file.

Loading the Cache File in the Animation Mixer

In addition to loading the cache file in the ICE tree, you can use the cache file in the animation mixer. You can apply the cache file to the same object for which you created the cache file, or to another object.

If you’re loading a cache file onto a different object, the number of points on this object must match the number of points that were on the object whose data was cached.

To get the files into the animation mixer, you can create cache tracks in the mixer and then import the cache files directly onto them. The cache file appears as clips on the tracks.

You can then use the cache files in the mixer to do things like creating cycles for looping simulations, using a timewarp on them to play the simulation backwards or change the timing, or blending cache clips together.

The process for loading a cache file created from the Cache on File node is the same as if you created it from the Tools > Plot > Write Geometry to Cache command. See Loading the Cache File into the Animation Mixer for information.

Blending Cache Files

You can blend the ICE attribute data stored in a cache file with another cache file, or with the object’s current attribute data in the scene.

In the Cache on File property editor, click the General Controls tab and select one or more of these options to control the blending.

Blend specifies the amount of blending of attribute values from the cache file with the ones in other cache files or in the current scene. Set this value to 1 to simply overwrite the other attribute values with those in this cache file. Any value less than this uses only a percentage of the value weight in this cache file, such as a value of 0.5 using only 50% of the value weight.

Normalize normalizes (averages) the attribute values from the cache file with the ones in other cache files or in the current scene. If this option is not selected, the attribute values are added together (additive) when blended.

Overlay blends cache files by overlaying one cache file sequence with a second one. If this option is not selected, the particle’s ID is used. When overlaying, particles are linearly removed from the first sequence and added to the next one based on the second sequence. The balance is defined by the Blend value. A value of 0.5 means 50% of the particles in each cloud are deleted from the first sequence and then added to the next one. Their attributes are not blended.

Append merges the particles into the existing point cloud when loading multiple file cache sequences. The cached points are added to the existing points instead of replacing them. If this option is not selected, the particles blend with each other. This option works only on point clouds, not other types of geometry.

Copying Cache Files

You can copy cache files to easily move them from local drives to network drives. This is handy so that you can work and generate cache files locally, which is usually faster, and then copy them on the network for sharing with others or for using on a render farm.

In the Cache on File property editor, click the Copy Files tab and set the options as you like for copying the cache file that you have specified on the Main tab of this property editor:

• Select a Template Path from the list to where you want to copy the cache file. The Path is automatically selected from the defaults set up in the Simulation Preferences property editor.

The information here is taken from the File Cache Path Template preferences you have set up in the Simulation Preferences (see Setting the Default Paths for Cache Files). You can view or change the paths you have set up there.

• If you select Alternative Path, you can choose it from a browser—click the (...) button beside the text box to open the browser.

• Click the Copy to Template Path button to copy the cache file to this folder.

• Select a Second Path from the list for the cache file. This makes it easy to copy the cache file directly to another path right away, such as one on a network.

• Click the Copy to Second Path button to copy the cache file to this folder.

Cycling Simulation Frames for Caching Files

Using the Frame Cycle Control compound, you can cycle certain frames of the simulation and have it cached in a file or read from a cache file.

To cycle simulation frames

1. Select an object and open the ICE tree view.

2. Click the Tool tab in the preset manager on the left side of the ICE Tree.

3. Select the Frame Cycle Control compound from the Data Access group, and drag it into the graph area.

4. Select the Cache on File compound from the Data Access group, and drag it into the graph area.

5. Plug the Frame Cycle Control compound’s Frame Value output into the Frame port of the Cache on File compound. This can be whether the Cache on File is set for writing or reading cache data.

6. Open the Frame Cycle Control property editor and set up the cycles as you like. You can set the cycle length, hold the last frame, invert the simulation in the cycle, or offset the cycle by a certain number of frames.



Autodesk Softimage v.7.5