More Than One Way To (Partially) Skin A Cat

So you’ve been assigned a prop. It’s a trunk. The storyboards shows that the character will pick it up by its handles, unlatch it, and open it. A couple of controls – no great challenge for an experienced rigger like you!

You open the model and discover that it’s a dense mesh. There will be some extreme close ups, so there’s a lot of detail. Whatever. You setup your rig hierarchy, your controls, your joints. A control for the entire trunk, one for the lid, one for the latch, and one for each handle. You select your joints, and you select your meshes, and you create a skinCluster. Then you painstakingly select each mesh and flood the weights so any given geometry is influenced by a single joint.

…why?

Painting an entire mesh 100% to a joint is the equivalent of parenting the mesh to that joint. So why not just parent the mesh to the joint? Or, if the geometry has to remain in the same hierarchy through the pipeline, constrain the geometry to the joint using a decomposeMatrix node. If possible, group geometry that moves together under the same transform and constrain the transform.

But wait! The trunk is modeled as all one piece!

…why?

Unless there’s a good reason, like exporting to a game engine, you can, and should, break your model up into separate meshes. (This will also help surfacing, since it allows them to assign different shaders to individual objects). That way you can just drive the transform of geometry that moves rigidly, rather than deforming it.

But wait! The director changed their mind and now the handles are leather straps! Oh no, those need smooth deformation!

…so?

A skinCluster deforms each point of its input geometry by computing the sum of the vectors from the original point to the point transformed by each influence, with the vector scaled by that influence’s weight on that point. It calculates the transform of each influence by multiplying the .matrix and .bindPreMatrix values. When a skinCluster is created, the .bindPreMatrix values are set to the inverse of the .matrix values. A matrix multiplied by its inverse is an identity matrix, which is the equivalent a transform at the origin. Thus, when a skinned object’s influences are in the “bind pose”, the input and output geometry are identical.

 

Normally, the .bindPreMatrix values are static. However, they can be driven by any matrix value. This allows you to make a skinCluster behave “local” to a given transform. This can be accomplished several ways. For example, you can creating orthogonal transforms to the influences as children of the “local” transform, and connect their .worldInverseMatrix to the .bindPreMatrix plugs. You could also use math nodes to calculate the inverse matrix, but these are harder to adjust on the fly.

So you’ve been assigned a prop. It’s a trunk. The storyboards shows that the character will pick it up by its handles, unlatch it, and open it. A couple of controls – no great challenge for an experienced rigger like you!

You setup your rig hierarchy, your controls, your joints. A control for the entire trunk, one for the lid, one for the latch, and something special for those leather straps that are the handles. You re-group the geometry so the rigid pieces are grouped together, and constrain them to the controls. And then you skin the leather straps, the only part of the model that actually deforms. Much better.

But wait! The director changed their mind and now the handles are ropes!

…so it goes.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s