Ziva Anatomy Transfer (ZAT) is a set of tools to transfer creature geometry and Ziva rigs from a source creature onto a new creature.
Anatomy transfer makes it possible to design a Ziva creature once, then automatically transfer all of the geometry and rigging work onto another creature. The intent is to transfer creatures that are similar in shape. For example, Ziva Anatomy Transfer can transfer subjects of the same species, such as a horse onto another horse (of different shape/proportions), a slim male to a fat male, or a male to a female. They are also suitable for warping within a related family of species, such as, for example, warp a horse onto a zebra, or a cat onto a lion.
Ziva Anatomy Transfer assumes that you already have the “source” Ziva creature fully set up. Its geometry (tissue meshes, bone meshes, cloth meshes, etc.) must be available, as well as the Ziva rig (attachments, material properties, solver settings, muscle fibers, etc.). Given just the external mesh (the “skin”) of the target creature, ZAT can then warp the geometry, any skin clusters (such as on bone geometry), and the entire Ziva rig, from the source creature onto the target creature. The transferred creature can be optionally put into its own Ziva solver. From there, it can be saved to disk as a standalone creature, and/or simulated completely independently of the source creature.
Note that the user will need to provide good motion (i.e., sequence of joint angles that define the creature’s animation) for the target creature. ZAT does not retarget the motion from the source joint hierarchy onto the target joint hierarchy. It can, however, transfer the joint hierarchy from the source creature onto the target creature, though the joint hierarchy on the target creature may need to be manually adjusted, for example, to tweak joint orientations. ZAT can also transfer any skin clusters that you may be using, for example, to drive the bone geometry with your joint hierarchy.
Warping the geometry¶
Here, we discuss the various options for warping geometry from the source creature to the target creature. Ziva Anatomy Transfer supports 3 warping methods: Harmonic Warp, Bone Warp and radial basis function (RBF) warp.
This is our general-purpose method to warp the geometry (such as creature anatomy) from the source creature onto the target creature. It works on polygonal meshes, NURBS surfaces and curves, joints, and locators. This deformer solves a harmonic problem in the domain enclosed by the source cage, mapping the source cage onto the target cage, and as such maximizes the smoothness of the warp. The user provides the skin meshes of the source and target creatures (source and target “cages”), as well as the source creature’s geometry (such as internal anatomy) to warp. This feature can warp Maya meshes, representing, for example, tissues (muscles) or cloth objects (fascia). It can also warp Maya joint hierarchies, locators (including their orientation), and Maya NURBS curves and surfaces.
The “source cage” and “target cage” meshes must have the same number of vertices and must be closed. They define the volume in which the warp will be performed. The meshes to be warped must be inside the volume enclosed by the “source cage”. The output meshes will lie inside the volume enclosed by the “target cage”. The vertices of the “source cage” and “target cage” meshes must be in 1:1 correspondence and in the same order.
Harmonic warp is constrained to map the “source cage” mesh onto the “target cage” mesh. Subject to this constraint, it creates a deformation field, inside the volume enclosed by “source cage”, that is spatially as smooth as possible. The zHarmonicWarp.surfacePenalty parameter controls the hardness of the constraint. The larger the value, the harder the constraint: the “source cage” mesh will warp closer to the “target cage”, with a higher chance of the warp being unstable.
A tet mesh will be created internally. The tetSize parameter controls the resolution in Maya units. The smaller the value, the more precise the warp, but also the higher the resolution and the longer the computation time.
In order to execute the harmonic warp, select, in this order, the source creature skin, target creature skin, and one or more meshes/NURBS objects/joints/locators to be warped. Running zHarmonicWarp with these objects selected will create a zHarmonicWarp deformer node that deforms the shape(s).
MEL command and parameters¶
zHarmonicWarp [flags] [<source_cage> <target_cage> <shap(es)_to_warp>] -h -help <n/a> This message. -t -tetSize <float> Set the tet mesh size for the harmonic warp, in scene units. No tets will be larger than this value. -m -maxResolution <int> Interrupts the computation if the smallest tet would divide the object into more than this many tets per side. For example, if maxResolution=100, then the tet meshing will abort if the tets will be smaller than 1% of the width of the object. This does not affect the result (assuming the computation was not interrupted). This usage is the same as in the zTet node. It exists to guard against crashing the tet mesher if tetSize is set to a tiny value. -s -surfacePenalty <float> Controls the tradeoff between the smoothness of the output, and how precisely the warp obeys the target cage. This value is given on a log scale, and can be negative, zero or positive. Smaller values increase the smoothness at the cost of the warp deviating more from the target cage.
This is a specialized tool for warping Maya meshes that represent bones. In contrast to the harmonic warp, the bone warp keeps the bones straight and avoids distorting the “heads” of the bones’ geometry. The user provides the source and target cage meshes (such as the skin of the source and target creatures), the bone meshes to warp, and a landmark map. Landmarks are important anatomical features on the bone whose relative positions need to be preserved by the warp. The landmark map can be painted on the bone mesh interactively. A landmark is then placed automatically at the center of each “blob” (connected region with non-zero map values) of the painted landmark map. For each blob, the landmark position is computed as the average position of vertices in the blob, weighted with the painted vertex weights. Landmarks can be visualized by selecting the zBoneWarp node. This warp only operates on meshes (the “bone meshes”).
For simple bones, it should be sufficient to paint a landmark map that results in two landmarks, one on each end of the bone (on the “heads”). For more complex bones such as the hip bone, multiple landmarks will likely be required to preserve the bone shape and prevent the bone from poking through the skin. You can paint the landmark map by right-clicking on the bone mesh, and entering the Paint menu.
Each bone is warped by first warping its landmarks using the harmonic warp. Then, the bone geometry is warped using a special per-bone mesh deformation function defined by the landmarks. This ensures that the bones follow the landmarks, while remaining as straight as possible. The per-bone deformer is computed on a per-bone tet mesh; the tet mesh resolution is controlled by the boneTetMeshResolution parameter.
See Harmonic Warp for additional details on how the harmonic warp works. All of the parameters common to both the zHarmonicWarp and zBoneWarp have the same effects. The requirements and properties of the source and target cages are also the same for zBoneWarp as they are for zHarmonicWarp.
In order to execute the bone warp, select, in this order, the source creature skin, target creature skin, and one or more bone meshes to warp. Running zBoneWarp with these objects selected will create a zBoneWarp deformer node that deforms the bone shape(s).
MEL command and parameters¶
zBoneWarp [flags] [<source_cage> <target_cage> <bone mesh(es)_to_warp>] -h -help <n/a> This message. -t -tetSize <float> Set the tet mesh size for the internally used harmonic warp, in scene units. No tets will be larger than this value. Same usage as in the zHarmonicWarp node. -m -maxResolution <int> Interrupts the computation if the smallest tet would divide the object into more than this many tets per side. For example, if maxResolution=100, then the tet meshing will abort if the tets will be smaller than 1% of the width of the object. This does not affect the result (assuming the computation was not interrupted). This usage is the same as in the zTet and zHarmonicWarp nodes. It exists to guard against crashing the tet mesher if tetSize is set to a tiny value. -s -surfacePenalty <float> Controls the tradeoff between the smoothness of the output, and how precisely the warp obeys the target cage. This value is given on a log scale, and can be negative, zero or positive. Smaller values increase the smoothness at the cost of the warp deviating more from the target cage. Same usage as in the zHarmonicWarp node. -b -boneTetMeshResolution <int> A tet mesh is computed for each bone, to aid with the bone warping. This parameter controls the resolution of this tet mesh: the size of the tets is the width of the bone divided by this value. -i -maxIterations <int> Maximum number of iterations used to compute the per-bone deformer.
This is a warp deformer that uses Radial Basis Functions (RBF). Compared to the harmonic warp, it does not explicitly maximize warp smoothness; however, it can warp geometry located outside of the warp cage. It can be used, for example, to warp geometry that is located outside of the creature’s skin, such as hair or eyebrows. This deformer can warp Maya meshes, NURBS surfaces and curves. In order to execute the warp, select the source creature skin, target creature skin, and one or more meshes to warp.
The “source cage” and “target cage” meshes must have the same number of vertices. The vertices of the “source cage” and “target cage” meshes must be in 1:1 correspondence and in the same order.
The command automatically computes suitable kernel centers on the source cage. The RBF deformation field is computed so that each kernel center maps onto the corresponding location on the target cage. There is no requirement for the warped mesh to be inside the source cage, or that the cage meshes must be closed. The cage should typically have lower resolution (and different topology) than the warped mesh.
In order to execute the warp, select, in this order, the source creature skin, target creature skin, and one or more meshes to warp. Running zRBFWarp with these objects selected will create a zRBFWarp deformer node that deforms the shape(s).
MEL command and parameters¶
zRBFWarp [flags] [<source_cage> <target_cage> <shape(es)_to_warp>] -h -help <n/a> This message. -k -maxKernelCenters <int> Set the maximum number of kernel centers.
Transferring Ziva rigs¶
Ziva Anatomy Transfer supports multiple operations to manage, copy and modify Ziva rigs. Internally, these operations are implemented using the zBuilder toolset.
Load/save a Ziva rig¶
Loads a Ziva rig from a disk file, and applies it to the specified solver.
Saves a Ziva rig in the select solver to a disk file. Only the Ziva rig in the selected solver is saved; rigs tied to other solvers are not saved.
# Load a Ziva rig from a file. Geometry must already be in the scene. # If solverName is not provided, the rig is applied to the solver stored in the zBuilder file. # If solverName is provided, replace the name of the solver stored in the zBuilder file with a given solverName, # and apply the rig to that solver. import zBuilder.utils as utils utils.load_rig(file_name, solver_name=None) # Save a Ziva rig to a file. # If there is only one solver in the scene, it is saved. # If there is multiple solvers, save the first solver in the union # of selected solvers and the default solver. import zBuilder.utils as utils utils.save_rig(file_name, solver_name=None)
Cut, copy, paste Ziva rigs¶
These commands make it possible to cut, copy and paste Ziva rigs. You can cut, copy and paste individual simulation bodies, or an entire solver. You can cut/copy/paste Ziva rigs from within the same creature, or from a creature onto a new creature. For example, suppose you have already rigged a part of the creature. Suppose you want to rig additional geometry that has the same number of mesh vertices and triangle connectivity (but not same vertex positions) as the already rigged objects. Then you can select those already rigged objects, copy them, and paste their Ziva rigs onto this previously un-rigged additional geometry. Note that for copying an entire Ziva rig of a creature onto a “clean” un-rigged creature, either into the same solver or into a separate solver, you can also use the zRigTransfer script (Transfer Ziva rig to a different solver).
# Cut the Ziva rig available on currently selected objects into the Ziva clipboard. # Selection cannot be empty; otherwise an error is reported. # Selection can contain zero or one solver node; otherwise an error is reported # (it does not matter if the solver node is a solver transform node, or solver shape node). # The selected objects must all come from exactly one solver; otherwise an error is reported. import zBuilder.utils as utils utils.rig_cut() # Copy the Ziva rig available on currently selected objects, into the Ziva clipboard. # Same usage notes as with rig_cut. import zBuilder.utils as utils utils.rig_copy() # Paste the Ziva rig from the Ziva clipboard onto scene geometry. # If nothing is selected, or the Ziva clipboard contains an explicit solver node, # the Ziva rig is applied to scene geometry that is named inside the Ziva clipboard. # If something is selected, then: # source selection 1 is pasted onto target selection 1; # source selection 2 is pasted onto target selection 2; and so on. # The pasted Ziva rig is added to the solver that was used for the last cut/copy operation. # If such a solver does not exist any more in the Maya scene (because, say, it has been cut), # it is created. import zBuilder.utils as utils utils.rig_paste()
Copy/paste Ziva rig with name substitution¶
Suppose you have already modeled the geometry of a creature,
and a Ziva rig on one half (say, the left side) of a creature.
This tool makes it possible to copy the
rig onto the other side of the creature.
This is achieved through regular expression replacements.
The method requires a regular expression (regularExpression),
and a string with which to replace any regular expression
For example, if regularExpression is
r_, then all instances
of geometry that begin with
r_ will be rigged
in the same way as the corresponding geometry that begins with
The newly added Ziva rig elements are added to the same solver
as the source. For example,
r_biceps will be rigged in the same
l_biceps. In order for all the elements of the Ziva
rig to be transferred properly (such as painted attachments, or
other painted properties),
the geometries of
l_biceps must be
mirror images of one another.
Note that this regular expression tool is more general
than just for mirroring; arbitrary Python regular
expressions are supported. Examples of useful pairs are:
You can learn more about regular expressions at the Regex101 website.
# Copy/Pastes Ziva rig for the selected solver, using regular expressions. # If multiple solvers are selected, only the first solver is processed. import zBuilder.utils as utils utils.copy_paste_with_substitution(regular_expression, string_to_substitute_matches_with)
Update Ziva rig¶
This command updates the Ziva rig in the selected solver to use the current geometry. This is useful if you made modifications to creature’s geometry after you converted it into Ziva simulation bodies. In this way, the Ziva rig is identical to a Ziva rig that you would obtain if the current geometry was originally used to make the Ziva simulation bodies directly. This feature is also useful if you warped a creature using one of our warping tools and you want to update the Ziva rig to use the newly warped geometry.
# Updates the Ziva rig in the solver(s). # This command can be used if you made geometry modifications and you'd like to re-use a previously # built Ziva rig on the modified geometry. # If no "solvers" are provided, they are inferred from selection. import zBuilder.utils as utils utils.rig_update(solvers=None)
Transfer Ziva rig to a different solver¶
Suppose you have a fully set up source Ziva creature with both the geometry and Ziva rig, and a target creature for which you have the geometry, but no Ziva rig. Suppose the target geometry has the same triangle connectivity but different vertex positions than the source geometry. This is the case, for example, when the target creature geometry was obtained by warping the source creature geometry using ZAT.
In this case, this feature makes it possible to transfer the Ziva rig from the source geometry onto the target geometry. The transferred rig is made available in whatever solver chosen by the user. A common choice is to make it available in its own separate solver, so that the target creature is completely independent of the source creature. After transferring the rig, the new Ziva rig on the target creature can be saved to disk using Load/save a Ziva rig. Optionally, the source creature and its solver can also be removed from the scene, using the Ziva->Remove->Selected Solver(s) command, leaving a scene that has just the target creature in it.
In order to warp the Ziva rig, you will need to provide the source and target solvers (in the dialog box).
# Transfers the Ziva rig from 'sourceSolver' to another solver (targetSolver). # This command does not transfer the geometry. It assumes that a copy of the geometry from sourceSolver is already available in the scene, prefixed by "prefix" (without the quotes). # For example, if sourceSolver is 'zSolver1', and prefix is 'warped_', and 'zSolver1' has a tissue geometry (a mesh) called "tissue1", # then this command assumes that there is a mesh called "warped_tissue1" in the scene. # The command generates a Ziva rig on the 'warped_*' geometry in the targetSolver. # If targetSolver is "", the command sets the targetSolver to sourceSolver + prefix. # If targetSolver does not exist yet, the command generates it. # Note that the targetSolver may be the same as the sourceSolver, in which case the rig on the 'warped_*' geometry is added into the sourceSolver. import zBuilder.utils as utils utils.rig_transfer(sourceSolver, prefix, targetSolver="")
Transferring Maya skin clusters¶
Suppose you have a fully set up Ziva creature. This creature likely has some Maya skin clusters that are used to drive the bone meshes based on the joint hierarchy motion. Suppose you have already transferred the bone meshes, and the joint hierarchy onto a new creature (“target creature”). This feature makes it possible to transfer the skin clusters onto the meshes of the target creature. It does so by copying the skin cluster weights from source meshes to the target meshes, and by connecting the target meshes to the target joint hierarchy.
In order to perform this skin cluster transfer, the source and target creature meshes and joint hierarchies must all be in the scene. The target meshes and joints must be named the same as the source meshes and joints, but with a (configurable) prefix. The target meshes should not have any of the warper deformers (such as zBoneWarp) on them – as-if Maya’s Delete History function had been applied to these meshes. To execute the skin cluster transfer, select the source meshes and click the Ziva Transfer->Skin Cluster->Transfer command. This will copy the skin cluster to the target meshes and drive them with the target joint hierarchy.
# Transfer the skin clusters for the selected mesh(es) onto their warped counterpart(s), # and connect the warped mesh(es) to the warped joint hierarchy. # Both geometries must have the same topology. The names of the warped meshes must be prefixed with prefix. # This command assumes that both the source mesh(es) and the joint hierarchy driving it via the # skin cluster(s), have already been warped, and are prefixed with "prefix" (without the quotes). import zBuilder.utils as utils utils.skincluster_transfer(prefix="")