Handling runtime skeleton extensions

Hello,

I would like to ask for guidance on how to handle extending a character skeleton. The specific use case is a clothing system with these features:

- Some parts of a clothing piece might be simulated by Chaos Cloth (e.g. skirts)

- Some parts might be simulated based on their Physics Assets, using additional bones to drive the simulation (various dangling decorations such as ends of belts, pouches, decorative chains, long necklaces…)

- All the characters in the game can change clothes at virtually any time and can use all the clothes - it is not pre-determined which character will have which clothes

The workflow to create clothes we are currently testing is:

1) Create the model of the clothes in Maya using the character skeleton with added bones for all the dangling decorations mentioned above

2) Export as FBX, import in Unreal Editor as a Skeletal Mesh with skeleton set as our character skeleton

3) Create a Physics Asset for the clothes that defines colliders and simulation parameters for the decorations

4) Add the clothes among the Skeletal Mesh Components of our character

5) Assign to the component the created Physics asset and a simple Animation Blueprint which uses the RigidBody node to simulate based on the Physics Asset

(I left out the parts with setting up Chaos Cloth simulation, it is not important for my question)

Just a note: the new “Cloth Asset”-based workflow presented e.g. here: Chaos Cloth - Updates 5.6 | Tutorial works for us for clothes with no “decorations” (-> no Physics Asset needed for simulation), but we have not found a way to use it together with the decorations as you cannot assign a Physics Asset to a Cloth Asset. If there is a way to make it work, we would be interested. But for now, I will assume the workflow above.

The first problem we ran into is that after step 2, our skeleton is automatically extended by the added bones from the imported fbx (from the question about “master” skeleton here https://dev.epicgames.com/community/learning/knowledge\-base/7yy6/unreal\-engine\-faq\-animation I understand this is normal and to be expected). But we cannot have just 1 skeleton per character which includes the bones of their “base” skeleton + their clothes, because anybody can wear anything and there are thousands of possible combinations. Not to mention that this triggers changes in all the animation files, which is annoying.

I could see us using 2 skeletons: “base”, with only the standard bones, and “full”, which is a copy of the base skeleton + all the bones from all the cloth pieces. Since the clothes only extend (add “leaf” bones) the base skeleton, the full skeleton should be compatible with the base skeleton. We could then use base skeleton for all animations, but “full” skeleton when importing new clothing asset and have all our characters also use the full skeleton. So when they put on a piece of clothing, we add a new skeletal mesh component to the character, including its physics assets, which can drive the simulation of some of the bones (which they have since they are using the full skeleton) and at the same time we will still be able to play all our animations since the skeletons will be compatible. Would that work, is it the recommended approach?

One caveat I see is that we are going to have hundreds of differing clothes which add various bones to various places. Even if some of the bones are shared between several assets, I still expect to have at least hundreds of unique added bones. The “full” skeleton will then be very cluttered. Various FAQs on the topic I found say that having bones that are not animated has no performance overhead. Even so, it is going to have a possibly noticeable memory overhead, isn’t it?

We handled this in our previous project (different engine) by “runtime skeleton extension”: as the character changed their clothes, the original skeleton was copied, bones defined by the clothes were added to the copy and then the skeletons were swapped. Is there an option to do this in Unreal? I.e. to import without modifying the skeleton file, only add the bones to the runtime representation of the skeleton when the skeletal mesh component is added to the character’s actor.

Any recommendations are welcome.

Steps to Reproduce

I could also see to not have these decorations as part of the clothing at all, but have each be a completely separate skeletal mesh with its own skeleton and we would then only attach them as needed. This means no skeleton extension, just attaching other skeletons to the base skeleton at runtime. However, this would make authoring the assets a bit more involved for the artist: after finishing their modelling, they would then have to separate all the different moving parts to separate fbx’, import them all and add some metadata that specify which bone/socket on the base skeleton it should be attached to. Also, I have a concern about the continuity of the mesh when rendered. For example, let’s have a belt that has a dangling end. If the dangling part is a separate mesh, while the rest is part of the clothes mesh, it would create visible seam at the connection point, wouldn’t it?

There is a SetPhysicsAsset node that you can use inside the Cloth Asset Dataflow graph.

However it only uses the collision shapes and won’t add any rigid body physics to the cloth asset. This will have to be done separately inside a skeletal mesh.

What I have seen so far fall under two categories:

1. There are two skeletal meshes/components, the first one has the common skeleton, the second one contains all the additional bones plus the common bones.

The first skeletal mesh might be invisible or contains the common body render sections. It is the skeletal mesh that is animated.

The second skeletal mesh is the clothing, with the remaining clothing/accessories render sections that can be swapped

The animation is copied from one to the other using a copy pose.

The extra bones are used with the rigid body simulation or cloth simulation.

2. The clothing Skeletal Mesh with the extra bones is set as an attachment is an additional component.

It is attached to a single bone of the character skeletal mesh. Mainly works for backpack, capes, etc.

If you haven’t already, I recommend you read the following articles that might better inform your decisions:

https://dev.epicgames.com/documentation/en\-us/unreal\-engine/working\-with\-modular\-characters\-in\-unreal\-engine

https://dev.epicgames.com/documentation/en\-us/unreal\-engine/mutable\-overview\-in\-unreal\-engine