Unreal Engine Cloth Rigging

Posted by:

Rigging Clothes/Hair:

Importing and skinning clothing/hair in Maya::

  1. Inspect all clothing items.  All surfaces that are associated with the same mesh and will be solved by cloth must be part of the same surface and physically connected to each other by shared vertices.  For instance if you had buttons or a zipper head that were combined with the surface but not actually geometrically connected then those buttons and zipper wouldn’t follow the mesh when solved dynamically despite sharing the same bind and being technically part of the same object.
  2. Run a cleanup on your surfaces selecting non-manifold geometry.  Anything that you missed visually will be selected.
  3. Bind your skins:
    • Insure that the skinning method is Classic Linear (Unreal doesn’t support dual quaternion)
  1. Weight paint the clothes so the mesh clips through as little as possible during deformation.
    • Paint your skin weights making sure to move your character around ensuring that you get good deformation.  
    • Pose the character in semi-extreme poses to see where clipping occurs, refine weighting.
  2. IMPORTANT!:  Go through each surface and insure that each mesh has its own material.  Unreal recognizes different meshes bound to the same skeleton by the materials that have been assigned to them. Insure that all materials follow the proper naming convention:  M_CharacterName_MeshName.
  3. When you the character into Unreal we will need to retarget the skeleton.  Unreal uses a specific naming convention to automatically find the joints, if your bones don’t use this naming convention then you will have to manually associate the bones.  There is a python script called here:

Load that script in a python script window in your script editor.  Select all of the code and hit the number pad enter button. That will open a window that allows you to run a script that will take the specified prefix in the joint names and then rename all skeletal joints that Unreal considers in retargeting.  Note, a prefix is automatically loaded but may not be exactly what is in your scene. Insure that the prefix that you enter into the interface is exactly the same as is in your joint hierarchy. Now select the reference locator of your skeleton and run the script.  If you have used the script successfully then the joints affected will have names like: root, pelvis, thigh_r.

  1. At this point, save your scene as:  characterName_WithClothes_WholeSurfaces.
  2. Now Save a copy called: characterName_WithClothes_DeletedFaces.
  3. Delete all faces that are hidden by higher layers of clothing:
    1. Open up your quick selection set and select all faces within
    2. Delete faces
  4. Select all of your geometry and delete non deformation history.
  5. Save your scene.

Exporting/importing your character:

  1. All rigging and animation should be removed from the character’s skeleton for export as the skeletal mesh.
  2. Optimize your scene.
  3. Now select the group node with your skins and the reference locator for your skeleton and export selection options FBX.  The default settings should be fine.
  4. Import your FBX into your Unreal project

Retargeting for Animation:

  1. Go to your skeleton tab and on your Skeleton Tree tab there is a little totally overlookable dropdown menu:

  2. Click on that and then check Show Retargeting Options
  3. Right click on the root and then click Recursively Set Translation Retargeting Skeleton
  4. Left click on root and set it to Animation, set pelvis to Animation Scaled.
  5. Under the Retargeting Manager set the retargeting to humanoid.  If you used the renaming script mentioned above in the Maya section then all joints should have been automatically populated the correct retargeting information.  If you didn’t use that script you will have to go through and manually set each of your joints to their respective position in the hierarchy of the humanoid rig.
  6. Import an animation by importing it just as you would another character, but by default the importer will want to use your existing character’s skeleton.  Deselect that so that it looks like this :

  7. Under the Retargeting Manager do the same process of assigning bones that you did for the character you are working on.  If you didn’t have the opportunity to run the renaming script you can open the FBX up in Maya and run it there then re-export.
  8. Right click on the animation file in your content browser and Retarget Animation Assets→ Duplicate Anim Assets and Retarget.  This editor will allow you to retarget animation.
    • If the source panel is not automatically populated you may need to assign a preview mesh to the animation.  Double click the animation in your content browser and in your details panel assign a new mesh:
  1. Assign the animation to your character in the scene through the details panel.  


Unreal Cloth:

  1. the Unreal cloth tutorial has some outdated information and could be a lot more detailed. Definitely look on their website for guidance, but just know that there are some holes.
  2. Double click on your skeleton mesh to open up the editor for it.
  3. Edit the Physics objects:
    1. First go to the physics tab and adjust/remove the collision objects for your character,
    2. Delete all of the default physics bodies and save your asset.  We will come back to creating these later for now they just get in the way.


Create the Cloth Data:

  1. Go back to your Mesh tab
  2. Use Section Selection to select the mesh you want to convert to a clothing asset.
  3. Right Click and choose Create Clothing Data from Section.
  4. Do not check Remove from Mesh.  The mesh just flies away if you have this checked.
  5. Be sure to name it something useful, it automatically populates a name from the shader but the last bit should be changed to reflect the item you are working with.
  6. Assign the clothing data to the surface.  Right click and Apply Clothing Data, but also look in your asset details panel under LOD 0.  The shader that is currently assigned to the object that has been selected will have its Highlight box checked.  Under the Clothing dropdown select the appropriate clothing asset which is of course properly named and easy to identify because you followed the previous steps.  Now you are ready to paint. Open the Cloth Paint tool.

Painting Cloth Weight:

  1. You have to make the appropriate selection from the Clothing Data field at the top of the clothing window
  2. Start painting at very low values, periodically holding the h button on your keyboard to see how the cloth is hanging.  For better or worse the brush penetrates through all layers of the painted surface. This is great for hair, but not necessarily great for layers of cloth that are part of the same surface (like collars).  There is no way to turn off this brush’s penetration feature so plan accordingly when deleting faces or repositioning surfaces prior to import.
    1. The default map that you are painting on is the distance map.  This controls how far away the verts can get from their skinned position.   
    2. Anything that you want to be completely controlled by the skin weight should be pink (a value of 0).
    3. Although all of the masks allow you to paint on the same scale (0-100) the values for each map vary in what they actually do.  The default map seems to be a value that relates to the coordinate system. A value of 1 over a vertex means that the vertex can move up to 1 centimeter from its animated position.  
  3. To create other masks click the plus sign on the right of the Masks tab.  You can then right click and change the mask to effect a different channel of the cloth.
    1. Anim drive multiplier returns the surface to it’s skinned position more rapidly. These values seem to be percentage based.  Values from 50 to 100 work well.
    2. Backstop Distance is how far a vert can get from its skinned position.  These values seem to also be actual distances of the coordinate system. Oddly this value seems to do the same thing that default value does, the only difference being that it is directly connected to backstop radius.
    3. Backstop radius works in conjunction with backstop distance.  Any overlapping positive values stiffens the surface by driving the vertices away from each other.  Again this map appears to be related to world coordinate values.  This map can actually puff the surface out as it drives the verts away from each other. Relevant values for this mask depends largely on the density of your surface.  The tighter your verts the smaller this value will have to be. Probably values between .25 and 1.5.
  4. Create Physics Bodies:
    1. These are imprecise and as far as cloth is concerned are designed to drive the cloth away during character movement.  They don’t work well as surfaces for the cloth to lay against as they are very simple shapes. If you are getting penetrations from lower levels of geometry you may be able to block the surface from penetrating too deep but you run the risk of having the cloth surface lay awkwardly away from the underlying surface that it should look like it is colliding with.  Hopefully at some point we will be able to use custom colliders for cloth. As of now custom colliders only work for dynamics like ragdoll physics.
    2. When creating physics bodies for collision you will find some settings in the details panel called Body Creation (should be lower right hand side of window).  Turn off Auto Orient to Bone, a setting that is so very inaccurate I don’t even know where to begin. Set to capsule or sphere whatever works best for your area.
    3. Select the bone that you want to create the physics object for and then hit the  Add Bodies button. Re-generate Bodies resets whatever mesh you currently have selected.
    4. The collision is not exactly the bounds of the object.  The actual affected field is an inch or so out away from the physics object.
  5. Test your cloth painting with animation to find out where it is failing.


  Related Posts

You must be logged in to post a comment.