- Home /
Unbind a skinned mesh in Unity
Goal: Keeping a correctly skinned mesh after applying blend mesh operation.
I have read documentation on trying to use blend mesh with a model. Blend mesh operation changes the bone weights on a vertex. I have copied the current weights for each vertex and stored it. Now I want to unbind my mesh in unity so that I can resize the joints/bones. I will copy back these weights after I re-position the joints after the blend mesh operation.
Does Unity support unbinding and binding a mesh in real time or do I need to use an external plugin for doing this?
To make things clear, I am trying to unbind a skinned mesh skeleton from mesh vertices in unity
Answer by Bunny83 · Jun 09, 2016 at 10:00 AM
No, Unity doesn't support such an operation out of the box. You would have to:
Bake the mesh manually
Use the baked mesh as new mesh and the current bone positions as new initial pose.
That's just how it theoritically should work. It's not that clear what the end result should look like. The bindposes docutmentation(linked already above) has a simple example how to create a skinned mesh procedurally.
If you only want to reposition the bones in the without affecting the mesh you might do:
create an exact copy of the bone hierarchy including the bones array of the SkinnedMeshRenderer.
Change the new bones the way you like.
When done recalculate the bindpose for the new bones and replace the bones array of the renderer.
From now on the mesh is using the new bones structure. However keep in mind that bone animations won't work anymore since they just set the bones to certain absolute position / rotation values. If you change the positions of the bones, i.e. you create a new skeleton, bone animations are no longer compatible with the bone structure. You can still play them, but they would deform the mesh most likely in a way you did not intend. Of course if you know what you're doing and you're creating the animation procedurally for this configuration it might work. Best example of procedural animation adaption is the game Spore, but that was created by the most skilled procedural content developers on earth which where hired from the demoscene.
Answer by GXMark · Aug 27, 2016 at 09:52 AM
If you only want to reposition the bones in the without affecting the mesh you might do:
• create an exact copy of the bone hierarchy including the bones array of the SkinnedMeshRenderer.
DONT DO THIS !
Just parent the skinned mesh renderers root bone to its parent transform. You then don't need to instantiate another set of game objects because the vertex weights are no longer being influenced.
Your answer
Follow this Question
Related Questions
SkinnedMeshRenderer: Change Bones at start without changing mesh or blendshape results. 0 Answers
Wrong bindPoses with generated mesh 1 Answer
skinned mesh renderer, combine meshes can't see the result, what am I doing wrong/ missing? 0 Answers
Why does adding cloth component to skinned meshrenderer move the bounds away from the mesh? 2 Answers