Cloth Physics + Morph Targets

Why use morph targets on cloth assets?

The traditional way to handle something like "shape-changing cloth" on a skinned mesh would be using bone manipulations via translating or scaling bones. This is a straightforward method since it requires just a few nodes. In addition, physics asset capsules also follow bone translations, meaning your simulating cloth will have its collisions match the updated shape. Many games can and do get away with bone manipulations alone to handle shape-changing simulating cloth.

The issue arises when you are dealing with highly customizable characters with many detailed morph shapes. In order to have cloth follow every shape, you'd have to create an unreasonable amount of bones to allow for precise adjustments on a per-morph basis, which is messy. In this case, it would be better to have cloth meshes that can follow morph targets, since morphs allow for precise control of vertices.

To get the best results from this method you'll have to use a combination of morph targets and bone manipulations, to ensure accurate collisions. Morph targets don't affect collisions, so you'll end up with clipping unless you ensure your character rig adjusts to match the morph shapes. This is explained on the Collisions page.

Solution

Using deformer graphs we can effectively enable morph targets on simulating Cloth Assets. The idea is to read the morph delta data from a skinned mesh with morph targets, and apply the offset to a simulating cloth asset.

This guide uses cloth assets from the experimental Panel Cloth Editor plugin. In theory it should also work with legacy cloth (i.e. cloth paint tool) however it's not something I've tested. I prefer the new cloth assets since they are more robust.

After you enable the plugin, the first thing you need is a skinned mesh with morph targets:

Next you'll need to create a Cloth Asset for use with the panel cloth plugin. If you're not familiar with the new panel cloth workflow, read the Epic page.

Add a SkeletalMeshImport node and select your mesh:

Then add the following nodes and paint the simulation area:

After that you can add whichever config nodes you want to use as normal. Refer to Epic documentation or the default cloth asset as an example on how these can configured. Also ensure your data graph contains a "SetPhysicsAsset" node so we get collisions from the character's physics asset.

Once you have the cloth simulating in the preview window you can proceed.

Now that we have a skinned mesh with morphs and a working cloth asset, we can apply the deformer graph. For this to work we need to have a skeletal mesh component and cloth asset component applied to the character simultaneously. We don't want the skeletal mesh visible, since it's only there to read data from. However if you disable its visibility, the deformer graph can't read from it, so the best solution is just to apply a masked material with an opacity value of 1.

Next you need to assign the deformer graph to the cloth component, which you can do in the details panel. It can also be set/unset at runtime via BP nodes.

Last updated