How to inverse the world matrix into a skin cluster?


#1

So I know this is possible because I’ve seen it done before. I’m trying to take a skinned mesh for a character, cut it up based on the body parts, and turn that mesh into the selection handles for the joints driving it.

I know it starts out with skinning your mesh to the joints, and then shape-parenting the geometry shape under the joint. This makes it so the mesh is the selection handle for the joint, but now the mesh is getting double transforms. One from the skinCluster and one from being the child of the joint.

So the next part I know the concept, but I don’t know how to do it. You need to inverse the worldMatrix of the joint through the skinCluster to the shape geometry, but I don’t know how to do that. Just plugging the inverse world matrix from the joint into the skin cluster doesn’t do anything. Replacing the joints input for worldmatrix driving the skinCluster Matrix with the joints inverseWorldMatrix turns the mesh all inside out, and just disconnecting it stops the skin cluster from deforming the mesh.

Any ideas on how to pull it off? It all looks good except for the double transform part.


#2

If it helps, I often remove double transforms by having a ctrl_01.translate --> multiplyDivide --> ctrl_01_group.translate. The multiplyDivide node is set at -1 for output and to multiply.

Basically, you’re driving ctrl_01’s parent with a -1 value which negates the double transforms. A situation where this could be used is having a rivet which is the parent of a joint on a mesh which is driven by a ctrl. The ctrl moves the joint, which moves the mesh, which moves the rivet, which moves the joint (double transforms occur here). Having the ctrl --> MD(multiply, -1) --> ctrl_group will negate those effects. There are tidier ways to setup the above example, but it’s just that: an example.

Not sure if that helps you, but worth a try. Good luck!


#3

Not sure that works in this case, because the joint is driving the geometry. I’m not parenting the geometry under the joint. I’m shape parenting it under the joint. So when you click on the geometry in the view finder, it’s actually selecting the joint now.

The worldMatrix of the joint goes into the skin cluster which is driving the deformation of the geometry. It also tells it to rotate as much as the joint when the joint rotates, because usually it wouldn’t be parented under that joint. The geo looses it’s transform node when you shape parent it under the joint, so that wouldn’t work in this case.
Best I can figure is maybe combine the two matrixes of the joint, worldMatrix and inverseWorldMatrix before going into the skin cluster. Because it needs to solve when that particular joint is rotating.


#6

Also you can use transformGeometry node to transform skinned geometry into local space of your “character world” transform e.g…
EDIT: sorry misread in your case that would be for transform/joint of matching skinned geometry. btw bindPreMatrix is just inverse world matrix of joint stored in skinCluster, so we use it for rig tweak tools => e.g. very easy to move joints bind matrix on all deformers simultaneously and etc.


#7

Yeah, I kept reading about that and suspected that was what to use, but how do you create that node? Is it script only or am I just missing the create panel for it?


#8

erm… in MEL

createNode transformGeometry

#9

Of course it’d be that easy and I spent hours looking for something far more complicated.

Thanks!


#10

Huh. Still not quite sure that I follow this.

So what am I’m plugging into the transformGeometry node and what does that plug into? I’m not very familiar with some of the functions on these nodes. Everything I try it tells me it doesn’t know how to handle the given geometry data.


#11

Er, well I think I got it working half way. It seems to be working without the double transforms.

Seems like I hook up the skinCluster.outputGeometry into the transformGeometry.inputGeometry and skinCluster.preBindMatrix to the transformGeometry.transform, then plug in the transformGeometry.outputGeometry to the shapes inMesh.

But now I’m getting where it’s moving the mesh farther away depending on what I guess is the pivot point. Seems like maybe it wants the geo’s pivot point placed at the pivot point of the parent of the joint you’re going to shape parent it under most likely. Is there any easy way around that, or is it just moving the pivot points?

EDIT: Never mind, I’m blind. That does nothing for the double transforms at least on the first joint. Any ideas?


#13

Is it possible for you to elaborate a bit more on the advantages of using bindPreMatrix or do you have sources that explain it in any detail? Thanks!


#14

I feel like something was missed somewhere.

If I do what you say below, and correct me if I’ve got this wrong, but here’s what I’m trying.

  1. Create two joints
  2. Create 2 cylinders the width of the joint chain.
  3. Parent the cylinder under each corresponding joint the cylinder is over and freeze transformations.
  4. Shape parent the cylinder under each corresponding joint.
  5. Create a transformGeometry node for each skin cluster.
  6. Brake the connection skinCluster.outputGeometry[0] --> sCylinderShape.inMesh
  7. Make the connection skinCluster.prebindMatrix --> transformGeometry.transform
  8. make the connecton transformGeometry.outputGeometry --> sCylinderShape.inMesh

So is there something I’m missing beyond that, or something I’m doing wrong there? Because when I do that, I loose the double transforms, but I also loose the skin deforming after that. I get the feeling there’s something that was skipped before your first message because it looks like you’re assuming I’ve got a transformGeometry node in the mix already from the start, but I don’t know how that fits into the mix yet other than they two connections you’ve mentioned.


#16

Hmm… Still not working.

So I think I’m getting thrown off at the TransformGeometry node.

there’s nothing showing up in the hypergraph, but if I look in the outliner and turn off show DAG objects only, there is one transformGeometry node. It’s before the pCylinderShape1Orig and a tweek node and then the skinCluster.

Am I supposed to pipe the skinCluster.preBindMatrix into that? When I do, the cylinder returns to the origine and flips upright again like when it was first created.

What version of Maya are you using? Maybe that’s it, and I’m not getting the right nodes generated? I’m using 2009 right now, but I’ll hop onto my other computer and try it in 2012 right now.


#17

Ok, I just tried it in 2012, and it’s the same thing there but I’m realizing it does make that transformGeometry node when you parent it under the joint, but only when it has creation history on it, like the primitves do. If you delete history on it or imported it or what ever, no transform geometry node.


#19

Hi, i just read this thread…some interesting concepts. Just for curiosity and trying to understand a little more about this…in order to select a joint with the selection of the skinned geometry, instead of shape parenting the mesh to the joint and going to the hassle for avoiding the double transforms, a trigger aproach won´t be easier, cleaner, and equally efective? I mean, by scripting telling maya that when you select object A, deselect it and select object B.


#20

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.