skin weight values

249 views
Skip to first unread message

Todd Widup

unread,
Oct 2, 2018, 7:27:06 PM10/2/18
to python_in...@googlegroups.com
hey all,

haven't had a chance to look but I am needing to get a skin weight value near a point in space relative to a skinned mesh...ie, my position is 3,4,5 and I need to know what the skin weight is at the closest point on a mesh to that..not vertex but arbitrary point....any suggestions at where to start looking?

--
Todd Widup
Creature TD / Technical Artist
todd....@gmail.com

Phil Sloggett

unread,
Oct 2, 2018, 8:05:02 PM10/2/18
to Python Programming for Autodesk Maya
MFnMesh has a getClosestPoint method, which will return the face id (among other things, including the specific surface hit-point) of the closest face. You can use the same class to "getPolygonVertices" using the face id. Then just get the skin weights per vertex, however you choose, for those verts. After that Im not super sure, maybe a weighted average of the skin weights based on your hit-points proximity to each of the poly verts?

Phil

Ollarin

unread,
Oct 2, 2018, 10:36:16 PM10/2/18
to Python Programming for Autodesk Maya
Quick and easy way is to check the position of that point in space first. Then move all influences one unit. Then check the delta's for this, this will equate to the normalized weight for that point for each influence. 

AK Eric

unread,
Oct 3, 2018, 11:13:19 PM10/3/18
to Python Programming for Autodesk Maya
It's non trivial (since Maya has nothing built in to do this), but you find the 3 verts closest to your point, and their weights.  If the point isn't exactly on that tri the 3 verts define, you need to use the vector maths to project it down to that plane.  You can then use some (roll your own) barrycentric coordinate math to figure out what that interpolated value is.  No example code since it's proprietary, but that's how I do it.
Reply all
Reply to author
Forward
0 new messages