Cache
Caching simulation
Blend Cache
Create
Attributes
Paint
Save/Read Frames
Render Cache
Removing Frames
Format
Caching simulation

The simulation can be baked in "cache" files. To cache a simulation, just set the attribute CacheName in the syCloth node. (See cache).
You can blend together cache files using the node syCache (see blend cache just below).
You can also render cached simulations on a render farm without using any Syflex licenses (see below cache render).
Blend Cache



The cache node is completely independent from all the other simulation nodes. It allows to blend together cached simulations.
Using this node you can:
  • Keep the first half of a simulation, keep the last half of another simulation, and fade in/out between them.
  • Blend the simulation with a shape, so that the simulation ends on a specific shape.
  • Keep parts of a simulation, painting with Artisan the parts you want to keep.
Create

To create a cache node:
  • Select the input shape.
    You can use the same input shape as for the cloth.
  • Select in the menu:
    Syflex > Cache > Create Blend Cache
  • Set the cache file name in the attribute page.
Attributes




Attributes of the cache node:
  • Active
    The node is active only when this attribute is switched to 'on'.
  • Cache Name
    These are the names of the input cached files. You can have up to 4 inputs. If you need less than 4 inputs, just left the fields empty.
  • Blend
    These are the blend coefficients. There is one coefficient for each cache.
  • Normalize
    When set to 'on', the blend coefficients are normalized (sum = 1).
  • Save Name
    If this field is not empty, save the resulting animation in the specified files. Animate the Active attribute to save only the frames you want.
Paint



There are four paintable attributes:
- map1
- map2
- map3
- map4
This allows to select parts of the object for each cache. The painted value is multiplied by the global Blend attribute.
Use the right button of the mouse to select the map you want to paint.

Save/Read Mesh


This items in the Syflex > Cache menu let you save/read one frame from a cached simulation from/to a mesh.
You need to have a mesh selected prior to calling these functions.
  • Save
    - Select a mesh.
    - Go to Syflex > Cache > Save Mesh
    - Select the cache file in which you want to save the mesh.
    This saves the shape geometry (vertex positions) in the specified file. The speed of each vertex is not set, or modified.
  • Read
    - Select a mesh.
    - Go to Syflex > Cache > Read Mesh
    - Select the cache file in which you want to save the mesh.
    The mesh selected must have the same number of vertices as the one saved in the cache: only vertex positions are saved in the cache: not the faces.
This can be used to modify one frame in a cached simulation: read the frame, modify the object, then save it back.

If you want a simulation to end on a specific shape, you can model this shape, save it in a cache file. Then use a blend cache node to blend the simulation with this shape.

Cache - Render

When the bottleneck is in the rendering, you want to render on as many machines as possible, without being limited by the number of Syflex licenses. This can be achieved easily by using the cache.
First, use the cache to bake the simulation data in files (see the cache attribute in the cloth).
Then instead of using the normal syflex plugin, the render needs to access the cache version of the plugin. This version has the same name, so you don't have to modify your scene. This plugin is not installed by default. You can find it on the CDrom at the following locations:
  • win/cache/syflex.mll
  • linux/cache/syflex.so
  • sgi/cache/syflex.so
Because this plugin doesn't require any license, you can use it to render on as many machines as you want.
You cannot modify any parameters of the simulation, except the cache file name in the cloth attributes (under extra-attributes).

If the cache was created on SGI, and you want to use it on a PC (or vice versa), you need to convert the data. Use the command syflex_cache:
syflex_cache cache_file.1 new_cache_file.1
You may need to convert all the cache files. Use a loop command in unix:
  foreach i (*)
    syflex_cache $i new_$i
  end
The cache file structure is very simple, allowing you to build your own tools to edit this data. It is a binary file, containing:
- all the vertex positions first
- then all the vertex velocities
Each position (or velocity) consists of 3 floats values (x, y and z).
Vertices are ordered in the same way as in Maya.

Removing Frames

You can easily check which frames are saved.
For instance if the cache name is "C:\tmp\a." (files are "C:\tmp\a.xxxx") call the mel command:
syCacheGetFrames "C:\tmp\a."
It returns (in a string) the saved frames, using the following format:
- a frame number
- or two numbers a:b meaning frames a to b

You can remove frames in a cache. For instance to remove frames 5 to 10 and frame 20, call the mel command:
syCacheDelFrames "C:\tmp\a." "5:10 20"

To remove all the cache files:
- Select the cloth
- Syflex > Cache > Clear Cache

Format

The cache file has a very simple format. It only contains the vertex positions and velocities. If the cloth has n vertices, the cache file contains n*2*(3*floats). Positions are saved first, followed by velocities.
  (x,y,z) vertex 0
  (x,y,z) vertex 1
  ...
  (x,y,z) vertex n-1
  
  (vx,vy,vz) vertex 0
  (vx,vy,vz) vertex 1
  ...
  (vx,vy,vz) vertex n-1
There is no header in the file.
Syflex LLC - www.syflex.biz