Multiple geometry skinning

Hi all,
I’m trying to figure out what would be the best approach to, for example, attach a piece of clothing to a character (both have to be separate models). I understand that the vertices of the clothing will have to be influenced by the bones of the character’s skeleton. I just have no idea where to start. Is that something that should be done in the modelling tool (blender in my case)? Would there be an issue with using gltf format to export from blender? What has to be done in order to end up with two j3o files, one for the character and one for the clothing, so they can be combined together later in tho process?

I will probably figure it out sooner or later myself but I thought that maybe someone already did this and would be so kind to point me in the right direction :slight_smile:

step 5 is exactly what you need, but here i share all info you might want later.
below is based on JME 3.3

step 1)

  • download Blender 2.8 (it already have proper GLTF in it)

step 2)

  • create character(use mirror modifier to make it quicker and better)
  • add skeleton(same, use mirror after half-bones are done to mirror - see YT videos how)
  • Holding SHIFT select character then select armature
  • press CTRL - P -> “with automatic weights” (there are envelopes too if you want learn)
    image
  • create cloth (static model) - make it wrap character body while modelling - make sure character is in default pose while doing it

step 3)

  • on made cloth - select it (use dataTransfer to copy bone weights from character to cloth)
  • now your cloth will be properly matched in animations with character body
  • add test animations, adjust mesh if need / etc.

step 4)

  • apply only part of cloth to cloth physics or all of it
  • you can also use DAC that is nice.

step 5)

  • to split into 2 files: Create new Blender file, press file -> append, select previous file, append Object -> Armature + cloth. (you need armature, otherwise JME will not export animations).

  • make sure in modifiers that cloth have proper armature linked

  • export using GLTF same way

  • in game code, load character, and later cloth, but append to character node(Armature node exactly), only cloth Geometries, not armature again.

      SceneGraphVisitor visitor = new SceneGraphVisitor() {
          @Override
          public void visit(Spatial spatTraversal) {
              if(!spatTraversal.getName().equals("Armature")){
                  ((Node)model.getChild("Armature")).attachChild(spatTraversal);
              }
          }
      };
      ((Node)clothes).breadthFirstTraversal(visitor);
    

step 6)

image

  • to make character feel alive, talking, or customize it even more, not just with bones, you can use shape keys (vertex shapes)
    Select model, and clikc “+”, it will add basic shape, then next “+” will add another shaped you can do and transform into them. (but please dont make too much of them - what you can, do with bones)

my example:

  • export model again using export -> GLTF (with setting selected objects and having selected what you need)

Even more helpfull things:

  • you can make IK bones in blender, and unselect deform:
    image
    it will be not exported as bone, but animation will be readed properly.

  • you dont need j3o (but it work faster)
    anyway you can load GLTF files directly

  • please note advice with shape keys work on JME 3.3+

  • using gradle instead of Ant give soem advantage later, so if you want, its worth to use it.
    (here use gradle in code project and Ant for assets - to SDK see them properly, grale just pull assets from ant project)

      runtime files("..//AssetsProject/assets")  // developer
7 Likes

That is THE ANSWER I didn’t even hope for!! Thanks a lot! I’ll give it a try and report back :slight_smile:

1 Like