Force joints' aim axes to point at their children in an already skinned mesh?


#1

I have three problematic joints: shoulder, elbow and wrist. After I skinned my model, I realized that possibly due to translation of said joints sometime before weighting, I slightly broke their orient, or aim axes to be specific. Now the shoulder joint doesn’t point directly at the elbow, but slightly to the side. Same with elbow and wrist. I’ve read dozens of threads on how to correct this, but everything I have tried didn’t do what I expected it to. Maybe I’m just tired painting those damned weights the whole night and can’t think clearly now.

I’ve tried rotating the Joint Orient in the Attribute Editor, but it also rotates all joints down in hierarchy. I’ve also tried setting the Joint Orient axes with CometTools when within Move Skinned Joints mode. This broke the weights completely.

I’m running out of ideas here… I need to somehow force the aim axes of those three joints to point at themselves. Shoulder at Elbow, Elbow at Wrist. Without affecting my skinned mesh that is.
Any hints?


#2

Okay, I think I came up with a solution which appears to be working. At least from the first glance. The Move Skinned Joints Tool is the way to go, but instead using it in conjunction with Comet’s JointOrient, I used the standard Orient Joint tool from the Skeleton menu to perform this reorient operation on shoulder and elbow. I only used Comet’s for tweaks (while still in Move Skinned Joints Tool mode. It threw an error (but still rotated tweaked joints over their aim axes):

…/cometTools/cometJointOrient.mel line 493: Freeze Transform or Reset Transform was not applied because node L_shoulder_jnt is a joint and has skin attached.

however I don’t think it harmed the rig in any way. Or so I hope… Should I be expecting trouble in the near future?


#3

I can’t say for sure whether you’ll have trouble with this or not, but just to mention another approach.

A while back I needed to reorient all of the joint axis in a skeleton (they came in from another app which uses a different aim axis) so I used Comet save skin weights to write the weights out to a text file. Then I deleted the cluster on the mesh and fixed up the skeleton, did a new smooth bind and then loaded the weights back on to the new cluster. A bit of a long way around but it worked fine. Obviously for tweaking a couple of joints though it would be nice to have a quicker way, hopefully someone else can advise on whether you’re likely to run into issues with your method or not.

Cheers,
Brian


#4

if you aren’t afraid of messing with mel, you could try this - use getAttr to get the joint’s worldInverseMatrix, after you’ve fixed the orientation. Then you’ll have to figure out the joint’s index number with the skin cluster. If you look at the connections in the hypergraph, you might see that the joint’s worldMatrix[0] is connected to skinCluster.matrix[x]… x is the index number you’re looking for.
Now you can use the setAttr command to apply those worldInverseMatrix values to skinCluster.bindPreMatrix[x].


#5

Wow, thank you guys for cool suggestions.
Exporting and reimporting skin weights is something I tried when looking for a solution to this problem, but I did this with Maya’s built-in exporter to image files. So when I imported them to skin cluster (after fixing the aim axes of those two joints), weights in some areas broke. And yeah, I’ve double checked for overlapping UVs and inverted shells, but didn’t find any. Even tried weight resolutions up to 8K without positive result. I’ve never had to use export/import weights before and thus was very surprised with the algorithm Autodesk chose to handle it. If you ask me, writing weights to image files will never be as foolproof as writing numerical values for each vertex->joint relation to a text file. I’d be more than eager to use Comet Save Weights, but unfortunately it doesn’t allow for batch export of multiple skinClusters and my character comprises of 86 poly objects. I’d have to manually export and then import each part separately and this would be a pain in the bacon. Still, if I had only one or a couple of parts, I’d most certainly go for it.

  Thanks for the MEL approach, @Lomax. I tried it and it works. Although I already had my joints corrected with a completely different, method. :) I'll describe it, as someone perhaps might find it useful. It also includes splitting joints on a skinned mesh to make ground for stretchy arms, plus mirroring and attaching them to skin.
  [b]
  CORRECTION OF AIM AXES[/b]
  So, basially I entered the [i]Move Skinned Joints[/i] (MSJ) mode (with shoulder and elbow joints selected) and oriented them correctly with built-in [i]Orient Joint[/i].
  Then, without leaving MSJ, I've numerically ([http://forums.cgsociety.org/showthread.php?f=88&t=1004303](http://forums.cgsociety.org/showthread.php?f=88&t=1004303)) rotated the rotation axes of both joints along their aim. If I were to rotate them with rotate tool, Maya would exit MSJ mode.
  
  [b]SPLITTING SKINNED JOINTS[/b]
  Next, using the [i]Joint Splitter[/i] script ([i]beJointSplit[/i]), I divided the shoulder-elbow and elbow-wrist bones into four parts, by adding three new joints in-between. After that, it was safe to leave the [i]Move Skinned Joints[/i] mode.
  
  [b]MIRRORING SPLITTED JOINTS TO THE OTHER SIDE[/b]
  The next step was to delete the opposite (right) side of a [i]clavicle->finger-tips[/i] joint chain. But before that, one thing had to be done.
  Every [i]skinCluster[/i] influenced by those joints, that were about to be removed, had to have an influence added that would preserve poly parts' connection with their [i]skinClusters[/i]. If I deleted the right side joints without doing that, my parts would simply drop out of the skinned rig. It didn't really matter which joint I chose, so I simply picked the nearest, one of the central spine joints (let's call it the "[i]Binder[/i]"). Then held weights of all influence joints in my skeleton (I found [i]Skinny[/i] script, available at [i]CreativeCrash[/i], to be a real help here) and began adding "[i]Binder's"[/i] influence to every part affected by the chain that was about to be deleted.

After it was done, I released all weights (that’s important) and deleted the right clavicle->finger tips chain. Then mirrored the left one and, using John Homer’s cool script (http://forums.cgsociety.org/showpost.php?p=2928653&postcount=5), joined its hierarchy with every surface the deleted chain was bound with.
The last two steps were mirroring the weights of each object to another and removing unnecessary influences generated in the process of rebinding with [i]Homer’s script /i.
That’s it. That did the trick.


#6

CORRECTION OF AIM AXES
So, basially I entered the Move Skinned Joints (MSJ) mode (with shoulder and elbow joints selected) and oriented them correctly with built-in Orient Joint.
Then, without leaving MSJ, I’ve numerically (http://forums.cgsociety.org/showthr…?f=88&t=1004303) rotated the rotation axes of both joints along their aim. If I were to rotate them with rotate tool, Maya would exit MSJ mode.

Actually it's wrong, but I found about it later, when I was creating arm controls. If parented to joint, the control group did not align properly to local rotation axes of the altered joints. Orient Joint did a job good, but the "rotate -r -os x y z" command, when applied to misc "?" LRAs somehow messed them up.

So this approach is really bad. Being short on time, I reverted back to a previous state, used CometJointOrient for tweaking, and despite the mentioned error message, everything seems to be working fine.


#7

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.