PDA

View Full Version : Reposition joints after Smoothbind?


cavery
03-23-2004, 09:16 PM
I am curious if it is possible to change the position of a joint after the character has ben smooth bound?

If I move the bone, because of the weights, my geometry deforms as well. Is there a way to temporarily disable the weights so that you can reposition joints?

john_homer
03-24-2004, 03:50 AM
Originally posted by cavery
Is there a way to temporarily disable the weights so that you can reposition joints?

No,
you can however, export the skinweights, detatch skin, move the joints, skin it, import weights.

.j

Firas
03-24-2004, 04:46 AM
john_homer, this is one Maya weak points .. but am sure its possible to automate this in a mel.

i hope in maya 6 alias had worked on it.. if not .. i'll put it in my plan to make it.

macaroniKazoo
03-24-2004, 07:05 AM
it might actually be really easy to do through mel - by manually changing the bind pose attributes on the joint that you want to change... after all, thats the only thing thats different after you re-skin.

so maybe you could just write some mel that reads all the joints in the skin cluster, and then re-sets their bindpose translate/rotate to their current values. that should work a treat. shouldn't be that hard to write either.
cheers,
-h.

dwalden74
03-24-2004, 12:52 PM
Keep in mind that as soon as you start moving joints around, your joint orientations are gonna´ start to go out of whack, and in many cases you´re not going to want this. This is probably one reason why Maya doesn´t offer this as a feature.

Hamish, just out of curiosity, without detaching the geometry how, do you know what values to set the bindPose attrs to? I´m confused because this attribute doesn´t change when you start moving joints around. Also, I just tried doing exactly this and setting the bindPose matrix had absolutely no effect on my binded nurbsSphere.

-david

Gnimmel
03-24-2004, 07:44 PM
Yes you can reposition the joints after a smoothbind very easily.
Detach the skin, making sure the `keep history` option is on.
You can now move your joints around as much as you like and the mesh will not move. When you are done bind it back up again.
You should get an error at this point saying you are not in bind pose, however I just tired a quick test on maya 5.01 and I never got this error???? Not sure why, but I was able to move joints around and re-bind without touching the bindpose. Is this a new 5.01 feature?
Anyway, if you do get this error, there is a mel command to reset it (sorry can't remember the command, anyone?), but you can also simply delete the bind pose node (delete bindPose1) and then re-bind.

Richard

strarup
03-24-2004, 09:22 PM
Hi,

as I recall there are 3 scripts which make it posible...

enableJointMove by Søren 'kurgan' Jacobsen, which you can get on his site in the Melsection... -->
http://www.kurgan.dk

SkinAs by Christophe Petit...
http://www.highend3d.com/maya/mel/?section=animation#2305

and I believe there is one more script, however I can't remember it... :)

the method I usually use, requires that you do some stuff before the skinning, to be able to make modification on the rig, after the skinning has been done...

what I usually do is making a extra set of joints, which I use as SkinBindJoints, which I parent to the joint which should move them...

e.g. leftknee_bindskinjoint would be parented to the joint Left_Knee...

then if I need to make changes on the rig, e.g. move some joints, I then unparent the SkinBindJoints, and after finishning the modifications, I then reparent the SkinBindJoints... in this way I haven't effected the skin or the SkinBindJoints, and they will still be controlled by their originally joints... this was a trick I learned on the 3d animation course at the AnimationWorkshop in Viborg Denmark... :)

regards

Strarup

macaroniKazoo
03-24-2004, 09:32 PM
Hamish, just out of curiosity, without detaching the geometry how, do you know what values to set the bindPose attrs to? I´m confused because this attribute doesn´t change when you start moving joints around. Also, I just tried doing exactly this and setting the bindPose matrix had absolutely no effect on my binded nurbsSphere.david - to tell you the truth, I've never actually tried it... :) and if you've just tried it and it didn't work... shame. I wonder why it doesn't work tho. after all, the bindpose is needed to store the "zero" point for the joints. so changing it, should enable you to "reset" your bindpose.

dwalden74
03-25-2004, 06:59 AM
Well let me know if you get it working... I tried it yesterday and it seemed a no-go.

-d

strarup
03-25-2004, 01:07 PM
Hi,

I thought I wanted to share this trick I learned during the 3d Animation Course... -->
http://www.animwork.dk/Default.asp?ID=141
at the AnimationWorkshop Viborg Denmark... -->
http://www.animwork.dk

so here it comes... :)

How it works... -->


/*
1.)first you select the joints that would need to be a part of the
skinning... and then execute this command "createSkinJoints;"
*/
//create the skinjoint procedure...
global proc createSkinJoints()
{
string $daJoint[] = `ls -dag -sl -type joint`;
float $daOffset = 0.3;
int $i;

for ($i=0; $i<size($daJoint); $i++)
{
select $daJoint[$i];
float $pos[2] = `xform -ws -q -t $daJoint[$i]`;
joint -p ($pos[0]) ($pos[1]+$offset) ($pos[2]) -n ($daJoint[$i] + "_SkJo");

}
}

/*-------------------------------------------------------------------------
2.)
then when you want to Smoothbind your skeleton,
write "selectSkinJoints;" and then click/select/add the geometry
your want it to bind to, and then SmoothBind them...
*/

//select the skinjoints procedure...
global proc selectSkinJoints()
{
select -cl; //clear the selection list
if (`objExists "*_SkJo"`){select -add "*_SkJo";}
else {print("error: No SkinJoints exist");}

//string $daSkinJointList[] = `ls -sl`;//just a test
//print($daSkinJointList);//just a test
}

/*-----------------------------------------------------------------------
3.)
if you then want to make some changes on your skeleton, you
can then unparent the skinJoints, by
writing "unparentSkinJoints;"... and then afterwards make your
modifications to the skeleton...
*/

//unparent the skinJoins procedure...
global proc unparentSkinJoints()
{
//first Select all SkinJoints...
selectSkinJoints;
//unparent them...
parent -w;
//clear the selection list...
select -cl;
}

/*-----------------------------------------------------------------
4.)

when you have finished your modifications on your skelton, you
can then reparent the skinJoints to the skeleton, by
writing "parentSkinJoints;"...
*/

//reparent the skinJoints procedure...
global proc parentSkinJoints()
{
selectSkinJoints;

string $daSkinJointList[] = `ls -sl`;
int $i;
for ($i=0; $i<size($daSkinJointList); $i++)
{
string $pJoint = `substitute "_SkJo" $daSkinJointList[$i] ""`;;
parent $daSkinJointList[$i] $pJoint;
// print($pJoint+" \n"); //just a test


}
//clear the selection list...
select -cl;
}
//--------------------------------


some things to be aware about...

don't lock the rotation or transform of the SkinJoints... if you don't want to have them selectable you can template them...

//template SkinJoints procedure...
global proc templateSkinJoints()
{
selectSkinJoints;

string $daSkinJointList[] = `ls -sl`;
int $i;
for ($i=0; $i<size($daSkinJointList); $i++)
{
setAttr ($daSkinJointList[$i]+".template") 1;
}
//clear the selection list...
select -cl;
}

//untemplate SkinJoints procedure...
global proc untemplateSkinJoints()
{
selectSkinJoints;

string $daSkinJointList[] = `ls -sl`;
int $i;
for ($i=0; $i<size($daSkinJointList); $i++)
{
setAttr ($daSkinJointList[$i]+".template") 0;
}
//clear the selection list...
select -cl;
}

I would like to make a toggle for it in the future, but haven't quite figure out how to implement it yet...

I usually also give every joint in the skeleton an Unique name... there might come some problems if there are 2 joints which have the same name... then it might be that the getpath should be implemented... :)

also one thing to remember, don't rename the joints or skinjoints after they have been created... and if you do, make sure they have this relationship...
"SkeletonJoint" --> JointName
"SkinJoint"... --> JointName_SkJo

hope you can use it... :)

regards

Strarup

attached image explanation: all the yellowjoints are the SkinJoints, and the "red"-joins is the "Mother"-skeleton, which contain the joints which the skinjoints are parented to...
http://www.strarup.net/awug/SkJotest01.jpg

dwalden74
03-25-2004, 01:35 PM
strarup-

This is all fine, but I´m just wondering what practical use it has. I would think that in most cases when you want to move joints around, you´ll also want to update the positions of the binding joints as well, not to mention any influence objs you got in there. It doesn´t seem that this approach takes that into consideration. Also, what happens to your animation rig when you start moving joints around? In most cases when you move joints, their local rotation axises will no longer be lined up correctly, and this would most likely screw up your FK controls. I would make sure to realign the LRA´s before reparenting the joints. Any thoughts?

:beer:
-David

strarup
03-25-2004, 03:11 PM
Hi David,

I would think that in most cases when you want to move joints around, you´ll also want to update the positions of the binding joints as well,

eh... let's e.g. say that you have weight for the Knee, but then suddenly see, that the doesn't has the right position...

then you unparent the skinjoint... make the modification, e.g. placing the knee were it should be... refix jointorientation if that is needed... and when you have changed and finish your modification then you reparent the skinjoints...

the skinjoints only keeps the weightning, so when you unparent to move the controlling joints, the skin geomtry will not be effected... and then when you reparent it is still the same Joint that controls the movement of the joint...

it is a bit like that it works... I can't unfortunately not remember the whole theory behind it...


what happens to your animation rig when you start moving joints around? In most cases when you move joints, their local rotation axises will no longer be lined up correctly, and this would most likely screw up your FK controls. I would make sure to realign the LRA´s before reparenting the joints. Any thoughts?

this is a part of the modification process, and in this process the skinjoints are unparented... and will not be effected...

but I would think most people would fix their rotation axis, or whatever needed to make their rig work to the modification they have made...

and let's say e.g. someone forgot to fix the rotation axis, they could then unparent the skinjoints again, and then fix the rotation... and when they are finish with that, reparent the skinjoints...

regarding the FK controls... this might be different regarding who people have rigged their character, I usually "inject" the FK controls into the joints... and I have had no problems by using this method... :)

the only time I have had problem with this method, was when I had locked the skinjoints... :)

regards

Strarup

dwalden74
03-25-2004, 04:06 PM
and then when you reparent it is still the same Joint that controls the movement of the joint...

I understand this, it´s just that the skinning joint, when reparented, is now being controlled (rotated, translated, whatever) from a parent which is not in the position that you initially intended when you first did the bind. I just think if you did this you might get unexpected results (especially with multiple influence objs), and then have to reweight the geometry again. OK, if the repositioning is very slight, then this might be acceptable. I just think that if you go through the trouble to do a setup like this (OK, it´s not that hard), then you might as well write your own weight import/export tool which does fundamentally the same thing but would be a bit easier to manage ´cause you wouldn´t need to deal with 2 sets of joints (which also might be confusing for other people working on the rig).

The joint re-orientation issue is, in most cases, probably manageable via MEL, I just thought I´d mention that ´cause it is important.

CGTalk Moderation
01-17-2006, 08:00 PM
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.