mirror Skin weights

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 07 July 2013   #1
mirror Skin weights

I am relatively new to ins and outs of skinning and running in to some issues trying to mirror weights.

If I select my whole skinned mesh and use mirror weights it works as expected. However I want to only mirror weights on the character's torso. So I select all the vertices in the torso and then mirror the weights. Nothing happens, the old weights on the left side are still there, no changes.

If I manually select from the mirror from side 3 vertices and then select in the exact same order on the mirror to side, the exact same mirrored vertices and then hit mirror, it works on those vertices.

So do I seriously have to select vertices in the exact same order to mirror weights when using it on selected components. That makes it unusable unless for just 1 or 2 verts. I must be doing something wrong. Is this how the tool is intended to work when working on selected verts or am I using it incorrectly? I am using maya 2013, thanks for any ideas!

Last edited by fghajhe : 07 July 2013 at 05:04 AM.
 
Old 07 July 2013   #2
Selected verts act like a mask for the skin weight functions. Try turning on the reflection option in the selection tool settings (and choose the appropriate reflection axis) then you can easily select them on both sides simultaneously.

David
__________________
http://www.djx.com.au
 
Old 07 July 2013   #3
thank you David. I will keep that in mind. For now I have a sure method via a small script, my second in python so it could be written nicer but for now it works. To use just select the vertices you want to mirror too. What it does is perform the mirror weights on the whole mesh, then stores the new weights of the selected vertices in an array, undos the mirror weights, and reapplies the stored weights to the specified vertices.


Code:
import pymel.core as pm sel = pm.ls(selection = True, flatten = True) vi = [] for vertex in sel: vi.append (int(vertex.rsplit("[")[-1].rsplit("]")[0]))#return the vertex indices sCluster = pm.listConnections(pm.ls(sl = True, o = True), type = 'skinCluster')#get the skinCluster of the selected Mesh pm.copySkinWeights(ss=sCluster[0], ds = sCluster[0], mirrorMode = 'YZ', surfaceAssociation = 'closestPoint', influenceAssociation = 'closestJoint') ji = [] #jointIndices weight = [] #weightValues for i in vi: #copy weights ji.append( pm.getAttr( sCluster[0]+'.wl[' + str(i) + '].w' , mi = True) ) weight.append( pm.getAttr( sCluster[0]+'.wl[' + str(i) + '].w') ) ##pm.getAttr( sCluster[0]+'.wl[' + i + '].w' , mi = True) pm.undo() for i in vi: #paste weights tempJi = pm.getAttr( sCluster[0]+'.wl[' + str(i) + '].w' , mi = True) for t in tempJi: #zeroOut joint influences pm.setAttr( sCluster[0]+'.wl[' + str(i) + '].w['+ str(t)+']', 0 ) for i in range(len(vi)): #paste weights for w in range(len(weight[i])): #paste stored weights pm.setAttr( sCluster[0]+'.wl[' + str(vi[i]) + '].w['+ str(ji[i][w])+']', weight[i][w])
 
Old 07 July 2013   #4
Its great that you can write such a script, but I think the best advice I can give is... don't even bother with maya's skin weights tool. The ngSkinTools plugin is much, much better. You should look it up and give it a try. And if you are into scripting you can take advantage of the ngSkinTools api to automate certain parts of the process.

David
__________________
http://www.djx.com.au
 
Old 07 July 2013   #5
wow that's awesome, many thanks for the heads up. I will check that out!
 
Old 07 July 2013   #6
actually there is a bug in maya 2013, 2013.5 and 2014. but it seems to be fixed in maya2014 SP1 now ( according to the "whats fixed" in the release notes )

...............
the bug only happens , when you have components selected and just want to mirror certain vertecies

how it works anyways ( workaround ):
- after you do a mirrorWeights ( via the UI ) , make an UNDO
- then take a look in the script editor ( since this seems to be an UI_bug ) .
- there you find the exact MEL-command , that was called.

e.g.
copySkinWeights -ss skinCluster1 -ds skinCluster1 -mirrorMode YZ -mirrorInverse -surfaceAssociation closestPoint -influenceAssociation closestJoint;

- now just copy and paste the command , and call it manually in your scripteditor . it should work then .

-----
so no need for a script here . at least it worked for me , that way . during a heavy skinning-job i did lately .

it is actually a really annoying bug ..... and the solution is super-simple , you just have to know it.





----------
@edit:
wow , seems , like i am wrong .... sorry

Last edited by tonytouch : 07 July 2013 at 05:57 PM.
 
Old 07 July 2013   #7
Thank you for the idea but that function just performs a mirror on the whole mesh, not selected components (at least for me in maya 2013 prior to bug fix). Perhaps your mesh was for the most part symmetrical so it appeared to only affect the selection. No worries though I have finished the skinning. Thanks again!
 
Old 07 July 2013   #8
@edit:
holy crap .... guess this was wrong

Last edited by tonytouch : 07 July 2013 at 05:55 PM.
 
Old 07 July 2013   #9
ok ---- i guess i was wrong , sorry .
 
Old 07 July 2013   #10
hey - no problem. What I like about this forum is people are always trying to be helpful.
 
Old 07 July 2013   #11
I always make sure my character is at 0,0,0 standing on the ground plane with Maya's default cm units,...... and weight skin on one side. I do the right side...... And mirror a symmetrical character's weights from that.
If you skinned multiple meshes on the bind pose, go to frame zero and delete the {outdated} bind pose. (which deletes the bind pose matrix for your multiple objects which you originally bound)
This should reset the skin bind for the 'separate' objects, but not destroy it.
Try mirror from that.
 
Old 07 July 2013   #12
Thread automatically closed

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.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 08:50 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.