# Simulation Topics¶

## Physically Based Simulation¶

At its core, Ziva VFX is a physically based simulator. As input, it takes a complete description of the physical setup of the scene, including: materials, tissue volumes, bone motion, attachments between objects, gravity, etc. This is what you must provide when setting up a scene with Ziva VFX. From that input, it computes motion of tissues and cloth based on laws of physics. This is a fully-coupled interaction of all properties of the system at once.

### Technical Details¶

The elastic materials are modelled with the finite element methods (FEM). For a more technical introduction to FEM, see http://www.femdefo.org.

The solver uses implicit time integration with all force terms formulated implicitly. Implicit integration can handle stiff materials and attachments with large timesteps. Large deformations and nonlinear materials are supported. The solver supports simulating (1) deformable dynamics of soft tissues and (2) quasi-statics. More information is available in the Integrators section.

## Simulation Objects¶

### Bones¶

Bones are externally animated Maya meshes of any geometry and purpose whatsoever. The Ziva solver does not simulate the bones or modify their motion in any way. The bones may deform and/or be animated using any Maya technique. The “bone” surfaces are not restricted to represent biological bones, but can be the result of any transformation or deformation in your Maya session (skin cluster, keyframe animation, loaded from an Alembic bake, any Maya deformer).

One common use it to have bones come from a previously baked simulation run. This makes it possible, say, to bake the result of a previous simulation as a deformable “bone”, and then constrain the next simulation layer to it, using Attachments. In this way, one can progressively generate an animation, by layering the muscles, fat, skin, etc. Each of these layers can be a separate solve with the result of the previous layer treated as a deformable bone for the next layer.

### Cloth¶

Cloth models thin objects (represented with a triangle mesh), for example: sheets, cloth, membranes. Cloth is simulated using the Ziva solver. Cloth is suitable for simulation of fascia and skin, but may not be appropriate for clothing because it lacks a self-collision model.

### Tissue¶

Tissues are three-dimensional solid deformable objects. Tissues can be used to simulate biological solids like: muscles, fat, or skin. They can also be used for non-biological materials like: jello, rubber tires, foam blocks, and steel beams. Since 1.4, tissues support rest scale and pressure (see Cloth above).

### Subtissues¶

A subtissue defines material properties, muscle fibers, and attachments within another tissue. A subtissue does not appear as its own tet mesh in the physical simulation. This can be useful for a few different applications. The right way to think of subtissues are as a sort of inclusion in the parent tissue.

Subtissues can be a tool for specifying material properties on the interior of a mesh. While material properties are normally smoothly interpolated through the volume of a tissue, one can use a subtissue to specify a discontinuous change to different material properties in the middle of an object. For example, perhaps there is a stiff knot in the middle of a muscle.

Subtissues can be used to model muscles embedded in passive tissue. For example, an entire arm could be simulated as a single tissue, with the individual muscles acting as subtissues. Their contractions and different stiffnesses will affect the single parent tissue without simulating separate tet meshes.

Subtissues can be used to group together adjacent muscles into a single simulation object. This could provide a performance improvement if it uses fewer tets. It could also make rigging easier, as collisions and attachment between these muscles does not need to be setup. Since they are in the same object, that is all implicit. They will not slide relative to each other or penetrate.

## Attachments¶

The tissues, cloth, and bones can be connected to each other (constrained) with attachments. Any type of object can be attached to any other type of object, with the exception of bones to other bones. Bone-to-bone attachments are not included because bones are not simulated by Ziva VFX and hence such attachments would have no effect. Each attachment can be fixed (pinned) or sliding (free to move over a surface).

When attaching between two bodies, the order matters. The first object is the source and the second object is the target. When an attachment is created between two bodies, the vertices of the source object “reach out” to the target object and attach to the closest point on the target.

The “stiffness” attribute controls how much the attachment between the bodies can stretch. The stiffness can be further attenuated by painting the attachment weight between 0-1 on the source mesh. For sliding attachments, painting on the target mesh controls where the attachment is allowed to slide. It will not slide to an area painted with zero weight.

In practice, one often wants to attach a set of model vertices to another model. This can be achieved by painting an attachment weight of 1 at these vertices and a 0 weight at all the other vertices. In order to facilitate this process, the user can select the vertices using the Maya UI, selecting the other object, and creating an attachment. The attachment weights will be painted automatically.

A demonstration of attachments is available in the Built-in demo “Attachments” (on the Ziva Tools menu).

### Goaling Attachments¶

Goaling attachments exist to make a mesh A follow (“goal to”) an arbitrary animation of a mesh B with the same mesh connectivity. The motion of the goaling mesh A is solved with the Ziva solver. It obeys physics, while being constrained to follow the goal mesh B. The result is a compromise between physics and following the goal mesh animation. Typically, the goal mesh animation will be generated by artists using any Maya technique, for example, keyframe animation or standard skinning. The Ziva goaling attachment is then used to add “physics” to the animation, providing a compromise between physics and artist directability.

The goaling mesh A must be a Ziva tissue, and the goal mesh B must be a Ziva bone. The two meshes must have the same number of vertices, ordered in the same way. The strength of the goaling can be adjusted using the zGoalAttachment.strength attribute, and permits to adjust the tradeoff between following physics versus the goaled bone motion. This attribute can be painted spatially, making it possible to turn off goaling in selected regions, or weaken/strengthen it arbitrarily.

A demonstration of goaling is available in the Built-in demo “Goaling, Self-Collisions, Ziva Cache and Spatially-Varying Materials” (the “fish” demo; on the Ziva Tools menu).

## Collisions¶

To enable collisions, there is a “collisionDetection” attribute on the zSolver node. There are also per-body collision attributes on the zTissue, zCloth, and the zBone nodes. Like attachments; collision response can be Soft or Hard, and Fixed or Sliding.

Two bodies can only collide if at least one of them has “collisionVolume” turned on. Unless a mesh is closed and watertight, the “collisionVolume” attribute doesn’t make sense and shouldn’t be turned on. If it is turned on for a non watertight, it may or may not work properly.

When two bodies interact, the body with the more stable and/or restrictive collision response settings defines the interaction. When two bodies collide, the effective collision stiffness is a blend between the setting from the two objects. When a sliding contact interacts with a fixed contact; the interaction will be “fixed”. If a soft contact interacts with a hard contact; the interaction will be “hard”.

The “collisionPointSpacing” attribute on the solver can sometimes be very important. Collisions are processed on a point-by-point basis, starting with the vertices of the triangle meshes use to make the objects. Sometimes this is not enough resolution to captures the collisions, in which case additional points can be added during collision handling by setting “collisionPointSpacing” to the desired distance between adjacent collision points. Be aware that setting this parameter too small can easily generate a tremendous number of points, which will slow the solver down significantly. This can happen with the default settings, if your objects are very large. During a collision, the collision points are rendered in the Maya viewport, so the collision spacing can be seen.

A demonstration of collisions is available in the Built-in demos “Self-Collisions, Ziva Cache and Delaunay Tet Mesher” and “Collisions” (on the Ziva Tools menu).

## Integrators¶

Since v1.5, Ziva VFX supports multiple numerical integration schemes to evolve the state of elastic bodies from the current to the next timestep. The integrator choice is controlled by the “integrator” attribute on the zSolver node. The choices differ in their tradeoff between stability and ability to compute accurate dynamics, such as wave propagation, oscillation, bouncing and “jiggliness”. Four integrators are supported: implicit backward Euler, BDF2, TR-BDF2 and quasi-static.

• BackwardEuler: The implicit backward Euler is a stable integrator that generates very little dynamics. This was the integrator used in Ziva VFX versions prior to v1.5. It is the default integrator. Sometimes it is called BDF1 in numerical math literature. Use this integrator if you do not need accurate, lively soft body dynamics.

• BDF2: This is a second-order accurate integrator that gives good stability and much more dynamics than BackwardEuler. BDF2 stands for “Backward Difference Formula of order 2”. Use BDF2 in any situation where you want good dynamics. Although BackwardEuler can in principle generate progressively more dynamics (i.e., more secondary motion) as the number of substeps is increased (controlled by zSolver.substeps), this quickly becomes computationally very expensive. For a fixed computational budget, BDF2 generates much more dynamics than BackwardEuler. In our tests on complex creatures, we observed that BDF2 can generate the same amount of dynamics (meaning, visually similar dynamic effects) as BackwardEuler with 2x less computation time. This gain can be very significant for creatures whose tissues are expected to jiggle and oscillate.

• TR-BDF2: This is a predictor-corrector integrator popularized in papers by Prof. Klaus-Jurgen Bathe from MIT. It is a hybrid scheme that combines an energy-preserving scheme (implicit Newmark; also called the “trapezoid method”, hence “TR”) and BDF2. This integrator gives more even more dynamics than BDF2, for some small loss of stability. In some of our tests, we observed better generation of fat creases and folding when using TR-BDF2 compared to BDF2, at the same computational budget.

• QuasiStatic: with this integrator, bodies have no momentum and remain in a state of elastic equilibrium, as dictated by the attachments, collisions and gravity. Bodies will bend or stretch, but will have no dynamics. This integrator is useful in situations where dynamics is not desirable, for example, to generate blendshape targets.

Note

The quasi-static integrator requires that the creature is attached to the bones, so that the static equilibrium can be meaningfully defined and computed. Suppose you have, for example, a scene with a single tissue that is not attached to anything in the scene. Then, under BackwardEuler, BDF2 and TR-BDF2, the tissue will fall under gravity. With QuasiStatic, however, the behavior is undefined, and may produce arbitrary tissue positions and solver instabilities. When using the quasi-static integrator, all tissues and cloth objects in the scene must be sufficiently attached to the bones. For example, when modeling a creature, the muscles and skin need to be attached to the skeleton of the creature. It is not necessary that each muscle is individually attached to some bone; some muscles can be attached just to other muscles. However, collectively, the entire muscular system must be sufficiently constrained to the bones so that it cannot simply “fly off”. For anatomical simulation, this limitation does not pose a problem, as biological tissues will typically have many attachments.

Note

The integrator can be changed at each timestep, if you so desire. This is achieved by keyframing the zSolver.integrator attribute. For example, one workflow is to use QuasiStatic during a simulation run-up, and then switch to any other integrator when reaching the actual first desired frame. This ensures that the simulations are launched with zero velocity.

Note

BDF2 and TR-BDF2 produce much more dynamics than BackwardEuler. If you would like to match the pre-v1.5 behavior with BDF2 or TR-BDF2, you can decrease zSolver.substeps, or increase zSolver.stiffnessDamping. BDF2 and TR-BDF2 generally need a smaller number of zSolver.substeps to achieve the same level of dynamics as BackwardEuler, which decreases overall simulation time.

## Real World Units¶

Ziva VFX uses real-world scientific units for most parameters:

Value = Units
Lengths = meters [m]
Times = seconds [s]
Masses = kilograms [kg]
Material stiffness = N/m 2 = Pa = kg/(s 2 m)
Fiber strength = N/m 2
Attachment stiffness = N/m 3
Density = kg/m 3

Real world values are available for many materials, such as on Wikipedia and other sources.

## Elastic Materials¶

A material refers to the physical properties of a tissue or cloth. This includes simple properties like mass density, which affects mass and inertia. It also includes more complicated material properties, such as the relationship between strain (essentially displacement) and stress (essentially elastic forces). The general form of the relationship is determined by the material type, whereas the overall magnitude of the forces that the material experiences under the deformations is controlled by the stiffness and other numerical parameters. Ziva VFX provides a choice of elastic material types for tissues: StVK, neo-Hookean, co-rotational and anisotropic. For cloth there is only one model type present. These material types are common in computer graphics and engineering.

### Stiffness¶

The stiffness (how hard or soft it is) of a tissue or a cloth is controlled by adjusting the Young’s modulus parameter on the zMaterial node. This is the standard approach for measuring the stiffness of real-world objects in science and engineering. The values for many real materials are available. Example Young’s moduli:

 gelatin 1.0 * 10 0 = 1 brain 0.5 * 10 3 = 500 liver 0.7 * 10 3 = 700 breast tissue 0.9 * 10 3 = 900 fat 3.0 * 10 3 = 3,000 smooth muscle 5.0 * 10 3 = 5,000 skeletal muscle 1.2 * 10 4 = 12,000 cartilage 2.0 * 10 4 = 20,000 rubber 1.0 * 10 7 = 10,000,000 wood 0.6 * 10 9 = 600,000,000 tendon 1.0 * 10 9 = 1,000,000,000 plastic 1.5 * 10 9 = 1,500,000,000 bone 1.4 * 10 10 = 14,000,000,000 walnut shell 1.5 * 10 10 = 15,000,000,000 steel 2.0 * 10 11 = 200,000,000,000 diamond 1.0 * 10 12 = 1,000,000,000,000

Young’s moduli for various materials [N / m 2]

### Material Types¶

#### StVK Material¶

The Saint Venant–Kirchhoff (StVK) generally gives good visual results, and is our default material. This material becomes more and more stiff as it stretches, which is often useful in practice as it reduces excessive stretching. StVK and NeoHookean materials have an additional parameter: compression resistance. This important parameter controls the tissue’s volume preservation under large deformations. See more comments below, under Volume Preservation.

#### Neo-Hookean Material¶

Neo-Hookean materials do not become progressively stiffer under stretching, unlike StVK. This is a popular class of solid materials in engineering. They are often used to model rubber.

#### Co-rotational Material¶

The corotational material is a linear tissue material capable of resolving large rotations + a small amount of deformation applied on top of the rotation. One can apply large deformations too, but the material will visibly stretch/compress with little resistance (linearly), and without preserving volume. This material is very popular in computer graphics and engineering – it is used in many research papers and commercial systems. In comparison to StVK, this material is about 10% faster, but StVK generally looks better under large deformations.

#### Anisotropic Material¶

This gives a tissue material that is weaker (or stronger) in a plane orthogonal to the given specified anisotropic direction. The anisotropic direction can vary spatially, and is specified via the muscle fiber field. The relative strength of the orthogonal direction (transverse anisotropy) is specified in the zTissue node, and can assume any positive real value. A value of 1.0 gives an isotropic material, values less than 1.0 gives materials that are weaker in the orthogonal direction, whereas values greater than 1.0 give materials that are stronger in the orthogonal direction.

#### Cloth Material¶

The cloth in Ziva VFX is based on the “Baraff-Witkin” cloth model, as described in by D. Baraff and A. Witkin at SIGGRAPH 1998, but with a Ziva proprietary model for the bending energy which significantly improves simulation stability. The cloth material is controlled by prescribing its tensile, shear and bend strengths. The tensile strength controls how much the cloth resists tension or compression, shear strength controls how much the cloth resists shear, and bend strength controls how much the material resists bending. The neutral bending angle can either be zero (flat) or the angles in the input mesh.

### Layering and Blending Materials¶

All of the material properties defined on the zMaterial node (e.g. stiffness, volume preservation, and density) can be made to vary across the elastic object. This is done by using multiple zMaterial nodes on the same object (see Figure). Each zMaterial node defines a uniform homogeneous material, but the paintable zMaterial.weights is used as an ‘alpha mask’ to composite the material layers together. The earlier materials in the dependency graph are effectively over-written by later materials when the weight map is non-zero. The first zMaterial on each object must have weights=1, because there is no lower material layer to blend with.

For example, to make a solid ball whose left side is 10x stiffer than the right side, assign the default Young’s modulus to the base material (zMaterial1). Then, create a new material (zMaterial2), and assign 10x stiffer Young’s modulus to it. Then, paint the value of 0.0 onto the right side of the sphere for zMaterial2.weights, but leave the weights as 1.0 on the left side of the sphere.

The spatially-varying maps are painted on the triangle-mesh surface, via zMaterial.weights. These surface maps are smoothly extended into the volume before simulation begins, and then transferred on to the tetrahedral mesh. If the tet mesh resolution is significantly lower than the size of the painted features, then those material details will not be visible in the simulation.

While the material values may vary across each object, individual objects must be assigned only one material type (e.g. StVK, co-rotational, NeoHookean or Anisotropic). Different objects in the scene can have different types.

A demonstration of spatially-varying material is available in the Built-in demo “Spatially Varying Materials” (on the Ziva Tools menu).

## Volume Preservation¶

Volume preservation is visually important for the simulation of solids (tissues). Our plugin offers multiple ways to control tissue volume preservation.

First, there is the Poisson’s ratio parameter on the zMaterial node. Poisson’s ratio defines the relative change in volume under material stretching and successfully controls volume preservation under small deformations. Mathematically, it does not apply to large deformations, although it is often used in practice for that purpose also. Values near 0.5 cause the simulated material to act unnaturally stiff, so we don’t recommend putting Poisson’s ratio too high (e.g. stay below 0.45).

Our plugin can also preserve volume under large deformations via the volume conservation parameter on the zMaterial node. The higher this setting, the more the tissue preserves volume. The volume conservation parameter is independent of Young’s modulus, and typical effective values may be 10 2 to 10 7 times larger than the Young’s modulus.

Alternatively, the compression resistance parameter on the zTissue node can be used to prevent compression, but permit expansion. The compression resistance strength scales with Young’s modulus (stiffness) and typical effective values are in the 1000’s or 10,000’s.

Note

Large values for compression resistance may cause simulation instabilities requiring more substeps or Newton iterations to resolve. The volume conservation setting is typically more stable.

Using volume conservation or compression resistance makes it possible to simulate very soft materials. For example, try decreasing Young’s modulus to a very small value. With a sufficient level of volume conservation or compression resistance, you should see soft, goop-like behavior.

Ziva VFX provides two tools to manipulate the volume of tissues (and cloth) in physically-correct ways: Muscle Growth and Rest Scale. Volume preservation is always applied after these volume manipulation have been applied. In other words, the volume that will be preserved is the volume of the tissue after rest scale and muscle growth have been taken into account.

## Muscles¶

### Muscle Fibers¶

Adding a muscle fiber (the zFiber node) to a tissue allows it to contract like a real muscle. When excited (excitation > 0), the muscle will contract along the direction of its fibers, which are shown in the viewport. The fiber direction is controlled by painting the endpoints to 0 and 1 on the endpoint map. The fibers flow smoothly between the endpoints. The strength of the muscle controls how much it contracts and can be painted across the surface of the mesh.

The fiber will not contract past contractionLimit times its initial length. If contractionLimit is set to 0.5, then the muscle will attempt to contract to half its length. The elastic material will resist this contraction and its actual contracted length will be somewhere in between. If contractionLimit is set to 1.0, then the muscle will not contract at all, but excitation will make the material more stiff.

The excitation of each zFiber can be key-framed, allowing muscle contraction to be directly and artistically controlled. For a semi-automatic muscle excitation, a “line-of-action” can be added to each zFiber node. The line of action requires one or more curves as input, and it excites the muscle when the curve gets shorter. This still requires animating the curve with traditional rigging techniques, but then key-framing the excitation is unnecessary (though still possible). We find that a simple skin cluster is sufficiently good for rigging the line-of-action curve. The initial creation of a very simple curve can be done automatically with the zLineOfActionUtil command.

More than one fiber node can be added to the same tissue. They can all have different parameters and be excited independently.

### Muscle Growth¶

The muscle growth feature makes it possible to grow or shrink muscles in the direction perpendicular to the muscle fiber, using what is essentially a plastic deformation of the muscle’s elastic rest shape. This can be used to make muscles bulkier or leaner.

For example, suppose you have already rigged a Ziva character. You can keyframe-animate the muscleGrowthScale attribute from 1.0x to, say, 1.5x over a few frames and then run the simulation. Because muscle growth respects collisions, the result after the simulation stabilizes is a physically-correct creature whose muscles are 50% bulkier. Then you can save the resulting geometry and transfer the existing Ziva rig onto it using zBuilder. This will result in a brand new creature with bulkier muscles. In the same way, you could also make the muscles leaner.

Another application of muscle growth is to make muscle bulging more pronounced during muscle excitation. Suppose that exciting a muscle doesn’t quite give you the muscle shape that you want. You can then add or subtract from the contracted shape by setting muscleGrowthScale to a value greater than 1.0 or lower than 1.0, respectively. This gives you some rudimentary extra control over the muscle shape in its contracted state.

A third application is to simulate the effect of muscle growing or shrinking during the animation itself, e.g., to make it look like the character is being transformed into a super-muscular character or similar.

Muscle growth is set as a scaling factor. Its value must be greater than zero. Value of 1.0 means no growth. A value greater than 1.0 (e.g., 1.2, 1.5) will cause the muscle to grow perpendicularly to the fiber. Values less than 1.0 (e.g., 0.8) cause muscle shrinkage.

Muscle growth respects the painted fiber strength field and any subtissues. If there are multiple fibers on a tissue with muscle growth enabled, the growth effect is properly compounded, i.e., two identical fiber fields will cause double the muscle growth.

Muscle growth can be used in conjunction with line of action, so that line of action modulates the amount of muscle growth over time. This is done using the useLoaForMuscleGrowth attribute. When on, the muscleGrowthScale is internally multiplied with the line of action value. When off, the muscleGrowthScale value is used directly. If on, but there is no line of action connected, muscle growth will be turned off.

## Tetrahedal Meshes¶

The simulation of tissues internally operates on tetrahedral (tet) meshes. The tet mesh acts as a ‘cage’ that controls how the muscle can deform and is a key requirement to get right in a simulation.

### Lattice Tet Meshes¶

Our primary tet meshing approach is based on an adaptively refined regular lattice. This is controlled through the zTet node that’s created with every tissue.

A higher resolution tet mesh will allow more detailed deformations, but it will run slower. The single parameter ‘tet size’ sets the global maximum size that a tet can be anywhere in the volume. Starting with default parameters, changing ‘tet size’ is a natural place to start tweaking the resolution.

The resolution can also be spatially-varying across the surface and through the volume. To adjust the resolution across the surface of the tissues, paint the ‘weights’ map and adjust ‘surface refinement’. The resolution on the interior of the volume is a blend between the global ‘tet size’ and the surface resolution. ‘Refinement propagation’ controls the influence how much the surface resolution influences the interior.

The tet mesh can cover different parts of the volume of the given surface by changing the ‘fill interior’ parameter. The style should be chosen to best cover the region that is intended to be solid material. The “Empty Cavities” option is most likely the correct choice, but it requires watertight input meshes to work. It does not make sense with arbitrary meshes full of holes and intersections, for which “Filled Cavities” is probably the correct choice. The “Surface Only” option covers only the input triangle mesh. This is sometimes useful, but switching to cloth is often the more appropriate choice.

### Delaunay Tet Meshes¶

Delaunay refinement is an alternative approach to creating tet meshes, available through the zDelaunayTetMesh node. This strategy is less controllable and less reliable than the lattice-based tet meshes, but produces tet meshes that exactly match the shape of a given triangle mesh. This property is sometimes useful, but is not required for a high-quality simulation. We only recommend using this feature if you’re sure you need it.

The input to this node must be a quality manifold surface mesh. Meshes produced by the zIsoMesh node generally form good inputs to the zDelaunayTet node. The refinementQuality parameter controls the amount of mesh refinement. Valid values are in the 0 to 1 range. A value of 0.0 means no refinement, whereas 1.0 means high-quality refinement. It is recommended to keep this parameter at a value of 0.8 or higher.

To use IsoMesh and Delaunay tetrahedralization for a tissue, you can follow these steps:

1. Select the tissue (e.g. myTissue) and then choose the Ziva Tools➞Create Isosurface Triangle Mesh menu item. This creates myTissue_isoMeshShape and zIsoMesh1. Modify parameters on zIsoMesh1 to achieve the desired shape and resolution.
2. Select myTissue_isoMeshShape and then choose the Ziva Tools➞Create Delaunay Tet Mesh menu item. This creates myTissue_isoMesh_tetMeshShape and zDelaunayTetMesh1. The mesh myTissue_isoMesh_tetMeshShape looks that same as myTissue_isoMesh on the outside, but its interior is filled with tets.
3. Select the tissue (myTissue) and the tet mesh (myTissue_isoMesh_tetMeshShape) and then choose Ziva➞User Tet Mesh.
4. Run the simulation to view the results. On a simple setup with two spheres, as in the Tutorial, you can expect results as shown:

## Embedding Meshes into Tissues¶

The tissues in our system are simulated as tetrahedral meshes. When you generate a tissue, its triangle mesh is automatically embedded into the generated tet mesh. Additional Maya triangle meshes can be embedded into our tissue tet mesh, allowing you to easily update your simulation, say, if the triangle model is refined at a later stage in the production. Our attachments, collisions and space-varying coefficients are authored on triangle mesh geometry. Our solver then transfers these values to the tissue tet mesh. As a result, the editing of volume data is no more difficult than painting the weights for a skinCluster.

## Physical Effects¶

### Damping¶

Damping is the mechanism by which objects lose energy and slow down. Our plugin provides two kinds of damping, both adjustable in the solver node. “Stiffness damping” primarily dampens high-frequencies (rapid vibrations, in space and/or time). It is useful to increase stability without damping the simulation too much. “Mass damping” is a non-physical damping, somewhat like being under water. It slows all motions equally. We usually set “mass damping” to zero, and use a small amount of “stiffness damping”. Note that you definitely need a small amount of damping to keep the simulation stable.

### Inertial Damping¶

Inertial damping is a non-physical effect useful to enhance stability or handle non-physical inputs. Inertial damping prevents tissues from ‘feeling’ inertia due to large-scale motions (all affine modes: translation, rotation, shear, and scale). Tissues with inertial damping have no momentum from these modes. The tissue effectively acts like a quasi-statics for these modes, but normal dynamics for higher-frequency components. Small-scale deformations still have all of their inertia, so elastic waves travel through objects normally. Using this, tissues can be subjected to extreme acceleration without flying themselves apart. Enable this on the zTissue node. This is very different from the mass and stiffness damping available on the zSolver node. We prefer to leave this turned off until we see a specific need for it.

### Fields¶

External forces can be applied to Tissue and Cloth objects using Maya Fields. You can use this functionality, for example, to model wind forces. Any field that can be modeled using Maya Fields can serve as external forces to apply to the tissue or cloth.

Based on the size and material properties of your objects, you will likely have to adjust the Magnitude attribute of the Fields in your scene. For example, with a default PolySphere converted into a Tissue with default properties, an Air field requires a Magnitude of approximately 1,040,000 to counteract the acceleration due to gravity in the Ziva solver.

### Pressure¶

Pressure (zMaterial.pressure) applies external pressure to the surface of cloth or tissue objects. The pressure acts in a normal direction to the triangle mesh of the cloth or tissue, and the magnitude of the effect can be painted spatially.

For example, pressure can be applied to cloth (fascia) that wraps over muscles, which will cause it to fill-in any little valleys between the muscles. This will make the muscle geometry more pronounced. A similar effect can be achieved using tissues without any cloth objects: Model a layer of fat over the muscles as a tissue with an inner wall (the fascia) and an outer wall (the skin). Then, paint the pressure to zero on the skin and paint a negative pressure on the inner wall. This will cause the fat layer to shrink inwards and envelop the muscles. In many cases, such direct usage of pressure on tissues eliminates the need for the cloth and significantly reduces the simulation time and model complexity.

Pressure is given in units of $$N / m^2$$. A value of 0.0 means no pressure. Positive values mean that the pressure is trying to compress the volume enclosed by the cloth or tissue, and negative values mean that it is trying to expand it. It is common to use relatively large values such as, for example, 100.0. As one point of reference, the extra pressure felt by an object at the bottom of a shallow (~1m) swimming pool would be approximately 10,000.

Pressure can be animated over time using zCloth.pressureEnvelope or zTissue.pressureEnvelope. This can be used, for example, to ramp up the effect over a few frames, rather than activate it abruptly in one frame.

### Surface Tension¶

This feature (zMaterial.surfaceTension) adds a force that tries to minimize the surface area of an object while respecting elasticity and other forces. It can be applied to tissues or cloth. Effectively, this shrinks the object across its surface, but not in the interior. For example, if it is applied to to an elastic cube, it will turn it to a spherical shape. This feature can be used in conjunction with pressure for tissues for shrink-wrapping a layer of fat around muscle geometry. The difference between pressure and surface tension is that pressure will suck the fat layer into the valleys between the muscles, whereas surface tension will make the fat layer stretch across the gaps in the muscle shapes. Usually, pressure and surface tension should be used together, perhaps by varying amounts on different locations on the model. In both cases, the effect can be painted to only affect the inner wall of the fat layer.

It is possible to set surface tension to negative values. This will cause the triangle mesh to expand.

Surface tension can be animated over time using zCloth.surfaceTensionEnvelope or zTissue.surfaceTensionEnvelope.

### Rest Scale¶

Rest scale (zMaterial.restScale) causes a cloth or tissue to shrink or enlarge uniformly in all directions. This is accomplished by scaling the “rest shape” of the object by the given amount, causing the object’s internal elastic forces to deform the object into that scaled shape. For tissues, the entire volume enclosed by the tissue triangle mesh is shrunk/enlarged, not just the boundary.

This parameter can be painted spatially. A value of 1.0 means no scaling, which is the default. To shrink the cloth or tissue, set zMaterial.restScale to a value less than 1.0, for example 0.8. To expand it, use values above 1.0.

Rest scale can be animated over time using zCloth.restScaleEnvelope or zTissue.restScaleEnvelope. A value of 1.0 means that the scaling effect is fully applied, whereas 0.0 means that it is turned off. In-between values partially apply the effect. Negative values reverse the effect, and values greater than 1.0 exaggerate the effect.

This feature can be used to grow or shrink parts of the character, for animation or modeling purposes. For example, it can be used to easily make the ears of an elephant 2x larger, producing organic growth that is aware of collisions, gravity and other simulation parameters. A demonstration of cloth restScale and pressure is available in the Built-in demo “Cloth Rest Scale and Pressure” (on the Ziva Tools Menu).

The difference between surface tension and rest scale is that the surface tension applies only on the surface of the object, whereas rest scale applies everywhere in the volume of the object. It is of course possible to paint rest scale on the surface, and the values will be propagated into the interior, but rest scale will in any case be applied using the propagated values everywhere inside the volume. This difference is very important for tissues. When simulating a creature’s fat compressed against the muscles, we usually do not want to shrink the fat everywhere in its volume; instead, we only want shrinkage on the interior wall of the fat. This is where surface tension comes in handy: paint it to zero on the skin, and paint it to a positive value on the interior wall.

## Animatable Inertial Frame¶

The solver node can be transformed / animated using its translate, rotate and scale attributes, in the usual Maya fashion. If the solver node, and the bones of a creature, are transformed in unison, the space that the tissues or cloth are being solved in, will rigidly transform with the solver, canceling any inertial effect due to bone motion. This is useful for moving simulations away from origin without incurring inertial effects.

## Isosurface Triangle Mesh Creation¶

We can create well-conditioned triangle meshes using our Isosurface Triangle mesh generator. We use a level-set-based approach and 3D Delaunay meshing. The input is an arbitrary Maya polygonal mesh that does not need to be closed, manifold or well-formed. It can have cracks, duplicate faces, T-vertices, etc. The output is a 3D triangle re-meshing of the same surface, or an offset surface. For the offset, both positive, zero and negative values are supported. The re-mesher can also remesh triangular meshes that do not enclose any volume – in which case the provided offset must be greater than zero.

All the angles in the output triangulation are equal or greater than 30 degrees (unless manifoldness of the output surface is enforced, below). The output of this node is a Maya mesh. As such, it is independent of our solver, and can be used for any purpose in Maya.

The re-mesher does not assume that the input mesh is manifold or well-formed. It can work with arbitrary “polygon-soup meshes”, including one-sided surfaces and surfaces with holes. The remesher can be used to fill holes in non-watertight geometry and to create a good-looking surface matching the input geometry. In the context of our plugin, the remesher can be used to create a well-formed mesh to serve an input to tissue creation. The output of this node also provides a good starting point for Delaunay Tetrahedralization. The parameters to the remesher are the level-set value to mesh (the “isoValue”), the target size of the output triangles, and the level-set resolution.

The isoValue is specified in scene units, and can be positive, zero, or negative. Zero and negative values only make sense when the input object represents a solid volume. In such cases, the zero isosurface will effectively remesh the input surface. A negative value will effectively “shrink” the object, whereas a positive value will enlarge it. If the input is not a closed volume, then the zero (or negative) isosurface will be empty.

The triangle size is specified in dimensionless units, where 1.0 is a default triangle size. This parameter controls the size of the output triangles. For example, if you set it to 2.0, you can expect the output triangles to be approximately 2x larger than with 1.0. The larger the value, the coarser the mesh. Conversely, the smaller the value, the smaller the mesh, and the longer the running time.

The resolution controls the resolution of the internal level set representation. This controls what geometric features are visible to the method. Increasing the resolution will cause the output mesh to respect input detailed features more closely, at the cost of more memory and computation.

In many cases, the output of the remesher is a manifold surface. When it is not, the produceManifoldMesh parameter, if enabled, applies a post-processing step that attempts to make the mesh manifold by removing hanging faces and performing edge collapses. You can disable this post-processing by turning produceManifoldMesh off. The Delaunay 3D tet mesher needs a manifold mesh as input.

A demonstration of isomeshing is available in the Built-in demo “Isomesher” (on the Ziva Tools menu).