• Editor
  • Is it possible to weld meshes based on changes in an animation?

My use case requires adapting a single base skeleton and its animations to multiple body proportions - in this case, body weight. My first idea was to deform a mesh with weights and bones, but doing this proves difficult if you want other weights to affect the model (like a unified torso with three bones affecting it) and is not particularly intuitive, requiring multiple bones and transform constraints. My second idea was to create a specific animation just to change the mesh, and then blend it on another layer using the Alpha property (and when 4.3 releases, use Sliders for this purpose). This is pretty janky, but nets way better results, and it lets me change other stuff alongside it like leg position!

{A GIF of a Spine preview window. The first track plays a dynamic pose. The second track is a weight animation, and the viewer is sliding the Alpha meter back and forth to demonstrate. Once it hits 0, the body appears slim. Once it hits 100, it appears fat - the effect of the weight animation.}

{A screenshot of a Spine mesh during an animation. The mesh nodes are individually deformed to show the illusion of a fatter body than originally modelled.}

My problem now is that I need to make a top adapt to this edited body. Welding it regularly has no effect, since no bones are changed between these animations, and while changing the mesh of the top in said animation is technically viable, it'd have to be done manually to every skin implemented in the future. Is there a way to weld two meshes based on their state in an animation - or barring that, any techniques to achieve this effect? I feel it's pretty hacky as is. 😅

{A slot parent to the torso shows a tee shirt with the text "TEST". This has been modelled for the original, slim body. As soon as the viewer changes to the WEIGHT animation, the tee shirt remains unchanged as the body overflows to the sides, which breaks the effect.}

    Related Discussions
    ...

    To achieve the effect of adapting a top to a body that changes due to animation, you can use a combination of mesh weights and careful vertex placement. One approach is to ensure that the vertices of the top's mesh align with the vertices of the body's mesh, especially in areas where they overlap. This way, when the body's mesh deforms, the top's mesh will follow the deformation naturally. You can use weights to bind both meshes to the same bones, ensuring they move together. Additionally, using linked meshes can help maintain consistency across different skins, as they allow you to reuse the same mesh deformation across multiple attachments. However, if the shape of the top differs significantly from the body, you may need to manually adjust the mesh for each skin.

    For more detailed guidance, you can refer to the Spine tips on weights and bounciness and the blog on skin constraints for different proportions.

    honie First, please note that we generally do not recommend using a large number of deform keys. Deform keys should be used only when absolutely necessary, so using them for the purpose of creating a base model is not recommended.

    Could you please explain why the method using weights and bones did not work initially? Since you need to match the costume, using weights, bones, and constraints to manage the body shape should make things easier. If you could describe where you encountered issues, we could advise you on how to improve them.

      Misaki As an example, the setup I created while testing weights involves four bones (Top and Bottom L/R), four transform constraints, and seven weights, including the original three torso bones. More would have to be added to separate the legs, and add details like shading of the belly region deforming downwards.

      I've made the bones "overshoot" so that the weights don't have to go to 100% to reach the point next to said bone. I'm not sure if this is standard practice, but not doing this resulted in all the weight going to the back and front of the mesh when you deform somewhere else in the torso.

      Apart from being more complex to maintain, my main concern is that adding bones that deform a mesh in this way will make it harder to achieve other effects with meshes in the future. While for now my setup is only a Top, Middle and Bottom torso bones, along with four weights to deform the body, I would also want to add a "look at" weight that allows changing the perspective of the mesh, alongside other deform sliders (to make the body thinner, for example).

      With what little I've experimented with, I'm uncertain if all these weights can be thrown together into a cohesive mesh, so with the deform keys approach I was looking for a way to separate the "how the body shape looks" from the "how the bones move the mesh", if that makes sense.

      I've also seen some weirdness with moving bones with a deformed mesh. I assume that this is a weight painting problem that can be fine-tuned, but I am unsure if changing the weights for these bones will affect the look of the deformed mesh.

      {A rigged mesh with weight deforms being moved around. The sides deform in strange ways when moved.}

        honie

        I've made the bones "overshoot" so that the weights don't have to go to 100% to reach the point next to said bone. I'm not sure if this is standard practice, but not doing this resulted in all the weight going to the back and front of the mesh when you deform somewhere else in the torso.

        It is common to place bones for purposes such as adjusting body shape or creating 2.5D effects in positions that are offset from the positions of the mesh.

        With what little I've experimented with, I'm uncertain if all these weights can be thrown together into a cohesive mesh, so with the deform keys approach I was looking for a way to separate the "how the body shape looks" from the "how the bones move the mesh", if that makes sense.

        I think I understand what you want to do, but when using the same mesh for multiple shapes, I still think it's better to manage changes in body shape and pose separately using bones.
        Deforma keys have various drawbacks beyond performance issues. For example, deform keys cannot be named, so as a project becomes more complex, it becomes difficult to know what a particular deform key is for.
        In contrast, bones can be named, making it easier to understand what each bone is for.

        Additionally, when managing with deform keys, it becomes cumbersome if you need to modify the vertices of the mesh later. Newly added vertices do not inherently have deformation animation, so if you need to increase the number of vertices in the body mesh, you must manually adjust each deformation key to ensure the new vertices are in the correct position.
        In contrast, when managing with weights, newly added vertices automatically inherit the weights of surrounding vertices, so in most cases, animation adjustments are not required.

        I've also seen some weirdness with moving bones with a deformed mesh. I assume that this is a weight painting problem that can be fine-tuned, but I am unsure if changing the weights for these bones will affect the look of the deformed mesh.

        If you could provide more specific details on how it changed, I may be able to offer more specific advice. A common mistake is applying weight to a pose that is different from the bind pose, which results in vertices moving to unintended positions when weight is applied to specific bones. The following blog article provides a useful explanation of the concept of bind poses:
        https://esotericsoftware.com/blog/Mesh-binding-tutorial

        One suggestion is that using scale rather than transform constraints can be effective when adjusting bone positions. By turning off bone scale inheritance, you can achieve a setup where only the position of child bones moves when the parent bone's scale changes:

        I thought it might be useful to mention this just in case, as it may allow you to manage things in a simpler way without using transform constraints.