Performance Tuning

Here are some things you can do to increase the performance (reduce the runtime) of a ZivaVFX simulation. In all cases, there is a trade-off between runtime and some other desirable quality, so always consider these guidelines in the context of your needs.

Simulation Mesh Resolution

The biggest thing influencing the runtime of a simulation is the number of vertices in the tissue tet meshes and the cloth triangle meshes. These simulation mesh vertices are the degrees of freedom that the solver needs to figure out how to move over time. Doubling the number of simulation mesh vertices in the simulation more than doubles the runtime. The “ziva -info” MEL command will print the number of tet-mesh and tri-mesh vertices to the Script Editor.

Tet-Mesh Resolution

To make a sim run faster, reduce the number of tets on the sim by increasing zTet.tetSize. Increasing zTet.tetSize 2x generally decreases the number of tet mesh vertices by approximately 8x for tissues that have large filled interior sections; or by approximately 4x for tissues that are shell-like. One can keep the resolution high just where needed by painting the zTet.weights and using surface refinement as described in the Tetrahedal Meshes section.

zCloth Resolution

The simulation mesh for zCloth objects is the Maya mesh used to build it. Reduce this mesh’s resolution, with any remeshing tool, to reduce the runtime.

Collision Detection

Enabling collisions approximately doubles the runtime of Ziva VFX simulations. If you do not need collisions, turn them off on the zSolver node.

If only some bodies need to participate in collisions, disable the collisions or selfCollisions attribute on the zCloth, zTissue, or zBone nodes that do not need collisions (but keep the collisions option turned on in zSolver). This completely removes the cost of their collisions.

Collision detection is done directly with the triangles meshes used to construct the tissues, cloth, and bones in a Ziva VFX simulation. This gets slower when there are more vertices in these triangle meshes. To keep collisions fast, prefer triangle meshes that are as coarse as possible without compromising the accuracy of the shapes.

For tissues, one can use a Collision Mesh (found in the Menus) to set a different mesh for collisions than for tet-meshing, materials, and attachments. This can be used to set a low resolution collision mesh without compromising other aspects of the simulation.

Note that collision accuracy will be lower with large triangles than with small triangles. Accuracy can be recovered by setting zSolver.collisionPointSpacing to a small distance. This achieves similar accuracy to using triangles of that diameter by adding more collision points inside the triangles, but it is faster than directly using small triangles of that size. That said, avoid setting zSolver.collisionPointSpacing to very small values as this will create an unnecessarily large number of collision points.

Solver Steps

Every timestep, the simulation needs to do some work. A timestep is always done at least once per frame. For stability and quality, increasing zSolver.substeps will make the solver do multiple timesteps per Maya frame. Each step has approximately the same cost, so increasing substeps very directly increases the runtime.

One way to mitigate the cost of using multiple substeps is to reduce zSolver.maxNewtonIterations. This attribute limits the maximum amount of work done per substep. Lowering this down to 1 can sometimes significantly decrease the runtime. The downside is that it can make simulations more jittery, more damped, less stable, and prone to other weird stiffening artifacts.

Volume Preservation

Ziva VFX has several ways to preserve volume, described in the Volume Preservation section. Setting zMaterial.volumeConservation to anything other than zero causes simulations to slow down. For faster runtimes, prefer to use zTissue.compressionResistance when possible.

Inertial Damping and Volume Conservation Together

If Inertial Damping and Volume Conservation are both disabled (zTissue.inertialDamping=0 and zMaterial.volumeConservation=0), then the solver may use a faster algorithm. If either term is enabled anywhere in the scene, a slower algorithm is used.


This applies to attachment stiffness, contact stiffness, Young’s modulus, tensile stiffness, shear stiffness, and bend stiffness.

When possible, do not set stiffness to very large numbers. The visible difference between an attachment stiffness of 10^8 and 10^12 may be minimal, but that higher stiffness can cause the simulation to be ill-conditioned and take longer to solve. Whether or not this will affect the runtime speed is impossible to predict. It is not guaranteed to have any affect at all and smoothly changing stiffnesses will not smoothly change runtime speed.