- Home /
Applying different boneWeights to SkinnedMeshRenderer creates unwanted vert stretching
I've got a SkinnedMeshRenderer mesh object in my scene and a secondary mesh with the same number of verts, but slightly different vert positions. As long as I don't change the weight table of the object, I can replace the mesh vertices just fine. In addition, I can put 0.0 on already populated weights(in 3ds max) and it too will work just fine. However, when I set the weight table (in 3ds max) to "Delete Zeroed Weights" or try to add new weights for a vert the mesh gets distorted in unity when the new boneWeights are applied.
I've checked the boneWeights array; they are both the same length. Bone names haven't changed and vert indexes are preserved. I've tried recalculating bindPoses; it seems to cause more issues. Not really sure what bindPoses does anyway. The new mesh is working with the animation if I just add it to the scene as a new gameobject.
Has anyone dealt with this issue before and can point me in the right direction?
Answer by vandrewm · Jun 24, 2011 at 01:14 PM
Ah, thanks Dreamora for the answer, but I happened to figure it out this morning after spending 8 hours on this yesterday.
I wasn't calculating the bind poses to the right transform, this is what caused everything to go crazy.
bindPoses[x] = smr.bones[x].worldToLocalMatrix * [yourgameobject].transform.localToWorldMatrix;
I hope this helps anyone who might come across this.
Answer by Dreamora · Jun 24, 2011 at 01:21 AM
Check that you never use more than 4 weights (unsure what max does if you delete zeroed weights and if it resorts the weight array prior export or alike)
Check the quality settings on how many weights you allow at all and ensure that the lowest index weight is always the "most important one
That should help to make it work.
Your answer
![](https://koobas.hobune.stream/wayback/20220612115950im_/https://answers.unity.com/themes/thub/images/avi.jpg)