Tutorials

This page includes tutorials for getting acquainted with the most important features of the plugin. The intention is not to produce the best simulations, but rather minimal examples of how to use the various features and components provided in the plugin. The results of the tutorials are available under DeformPlugin Content > Levels > Tutorials. Please note that in the tutorial levels provided with the plugin, an OrbitalPawn is used. If you want to interact with the cloth in the levels you produce yourself, you would have to either add an Orbital Pawn to the scene, or create this functionality yourself, by calling the PickParticle, DragParticle and ReleaseParticle functions inside the Deform Manager.

You should always create a new scene for each tutorial.

Getting started

This tutorial describes how to import a mesh, making it a Deformable Body, and how to create an interesting simulation by hanging it from two corners.




Adding a Deform Manager

The Deform Manager works as a link between Unreal and the Deform Dynamics physics engine. The manager retrieves information about the scene in Unreal, and sends it to the physics engine. The physics engine then sends the updated information back to the manager, which delegates it out to the objects which have been affected by the simulation.

  1. Go to the Place mode in the Modes window.
  2. Search for Deform Manager in the search bar and drag it into the scene.
  3. Alternatively, Navigate to DeformPlugin C++ Classes > Deform Plugin > Public in the Content Browser and drag the Deform Manager into the scene.
  4. The manager is initialized with a set of default parameters that you can use. If you want to change the parameters, you can do it in the Deform Manager actor.

Adding a Deform Body

The Deform Body component specifies which meshes should be added to the simulation. It also takes care of the updating of the procedural mesh which is used to visualize the results provided by the engine.

  1. We have provided you with a low-resolution patch here. Download it and import it into your project.
  2. Add the imported mesh into your scene and change the location to (200, 0, 150).
  3. Add a Deform Body Component to the actor you just created. This will tell the physics engine that this mesh should be simulated.
  4. Change the material to a two-sided material. You can use the materials in the DeformPlugin content, for example blueMaterial.

Pinning two vertices

  1. With the actor containing the Deform Body Component selected, press the Deform Paint tab in the modes window. Make sure you have Pinning selected in the drop-down menu.
  2. In the scene view, you will notice a set of white particles corresponding with the vertices of the patch. Paint the corners of the cloth by moving the mouse cursor on top of the particles and press the Left Ctrl key. This method of painting will change in the future.

Running the simulation

  1. Press play in the Unreal editor.


The result from following this tutorial can be found here: DeformPlugin Content > Levels > Tutorials > GettingStarted.

Creating a clothed character

This tutorial describes how to create a garment simulation colliding with a character. In this tutorial, we will be using assets already present in the plugin content, but you could use your own assets as well.




Adding a Deform Manager

The Deform Manager component works as a link between Unreal and the Deform Dynamics physics engine. The manager retrieves information about the scene in Unreal, and sends it to the physics engine. The physics engine then sends the updated information back to the manager, which delegates it out to the objects which have been affected by the simulation.

  1. Go to the Place mode in the Modes window.
  2. Search for Deform Manager in the search bar and drag it into the scene.
  3. Alternatively, Navigate to DeformPlugin C++ Classes > Deform Plugin > Public in the Content Browser and drag the Deform Manager into the scene.
  4. The manager is initialized with a set of default parameters that you can use. Since the mesh we are going to simulate does not contain triangles of uniform size, we will enable Surface Sampling in the manager. If you want to change other parameters, there is more information here: Deform Manager actor.

Adding a Mesh Collider

The mesh collider creates a way for the deformable objects to interact with meshes in the Unreal Engine. It uses the triangle information of the mesh to do so.

  1. Navigate to DeformPlugin Content > Characters > Walking in the Content Browser and drag the animation sequence female_walking_Anim into the scene.
  2. In the female_walking_Anim details, set the location to (250, 0, 20) and the rotation to (0, 0, 90).
  3. Press the Add Component button and search for Deform Mesh Collider and add it.
  4. Select the Deform Mesh Collider component that you just added to the actor.
  5. Set the Kinetic Friction to 0.2, and the Static Friction to 0.4.
  6. Set the Bias to 0.0095.
  7. Enable Should Remesh and set Num Remeshed Vertices to 8000.

Adding a Deform Body

The Deform Body component specifies which meshes should be added to the simulation. It also takes care of the updating of the procedural mesh which is used to visualize the results provided by the engine.

  1. Navigate to DeformPlugin Content > Meshes in the Content Browser and drag the mesh asymmetric into the scene.
  2. In the asymmetric details, set the location to (211, 21, 142) and the rotation to (345, 0, 90). It is important that the simulation starts from a position where the cloth is adequately placed around the character.
  3. Set the material to blueMaterial.
  4. Press the Add Component button and search for Deform Body Component and add it.

Painting friction

To prevent some parts of the cloth from sliding too much, one can use the vertex paint editor to paint higher friction values. This can be useful when you have a thin shoulder strap, like in this case.

  1. With the asymmetric object selected, press the Deform Paint mode in the Modes window.
  2. Select Kinetic Friction in the drop-down menu.
  3. Set the coefficient to 0.8.
  4. Move the mouse over the shoulder strap of the garment while holding the Left Ctrl key down.



Running the simulation

  1. Press play in the Unreal editor.


The result from following this tutorial can be found here: DeformPlugin Content > Levels > Tutorials > ClothedCharacter.

Saving a rest pose

This tutorial describes how to setup a simulation to start from the correct rest position. This involves simulating the cloth to a configuration that is adapted to the body of the character, and saving the cloth in that state. Then we also have to set the Base Mesh in the Deform Body Component to use the correct rest values.




Adding a Deform Manager

The Deform Manager component works as a link between Unreal and the Deform Dynamics physics engine. The manager retrieves information about the scene in Unreal, and sends it to the physics engine. The physics engine then sends the updated information back to the manager, which delegates it out to the objects which have been affected by the simulation.

  1. Go to the Place mode in the Modes window.
  2. Search for Deform Manager in the search bar and drag it into the scene.
  3. Alternatively, Navigate to DeformPlugin C++ Classes > Deform Plugin > Public in the Content Browser and drag the Deform Manager into the scene.
  4. The manager is initialized with a set of default parameters that you can use. Since the mesh we are going to simulate does not contain triangles of uniform size, we will enable Surface Sampling in the manager. If you want to change other parameters, there is more information here: Deform Manager actor.

Adding a Mesh Collider

The mesh collider creates a way for the deformable objects to interact with meshes in the Unreal Engine. It uses the triangle information of the mesh to do so.

  1. Navigate to DeformPlugin Content > Characters > Walking in the Content Browser and drag the animation sequence female_walking_Anim into the scene.
  2. In the female_walking_Anim details, set the location to (250, 0, 20) and the rotation to (0, 0, 90).
  3. Press the Add Component button and search for Deform Mesh Collider and add it.
  4. Select the Deform Mesh Collider component that you just added to the actor.
  5. Set the Kinetic Friction to 0.2, and the Static Friction to 0.4.
  6. Set the Bias to 0.0095.
  7. Enable Should Remesh and set Num Remeshed Vertices to 8000.
  8. Disable the animation momentarily by unticking Playing in the SkeletalMeshComponent.

Adding a Deform Body

The Deform Body component specifies which meshes should be added to the simulation. It also takes care of the updating of the procedural mesh which is used to visualize the results provided by the engine.

  1. Navigate to DeformPlugin Content > Meshes in the Content Browser and drag the mesh asymmetric into the scene.
  2. In the asymmetric details, set the location to (211, 21, 142) and the rotation to (345, 0, 90). It is important that the simulation starts from a position where the cloth is adequately placed around the character.
  3. Set the material to blueMaterial.
  4. Press the Add Component button and search for Deform Body Component and add it.

Saving a good initial configuration

Now we will run the animation once just to retrieve a good rest position for the cloth and saving it using Unreal Engines Create StaticMesh function inside the UProceduralMeshComponent.

  1. Press play in the Unreal editor.
  2. Press Shift+F1 to unfocus the mouse cursor from the viewport.
  3. Navigate to the asymmetric object in the World Outliner.
  4. Navigate to the ProceduralMesh component inside the actor.
  5. Press Create StaticMesh, and save the mesh as DeformedDress to Content > Meshes.



Using the deformed mesh

We cannot use the mesh we just saved directly, because of the rest values being calculated using the deformed mesh. We want to have the same rest values as the original mesh. However, we can solve this by using Base Mesh inside the Deform Body Component.

  1. Select the asymmetric object int the World Outliner, and change the static mesh to the DeformedDress mesh we just saved in Content > Meshes.
  2. Now, select the Deform Body Component, and change the Base Mesh to asymmetric, which was the mesh we used originally.

Running the simulation

  1. Enable the character animation again by ticking Playing in the SkeletalMeshComponent
  2. Press play in the Unreal editor.


The result from following this tutorial can be found here: DeformPlugin Content > Levels > Tutorials > RestPose.

Using collision masks

This tutorial describes how to use collision masks to filter out collisions between the character and the cloth. This functionality can be useful when the character animation is causing unwanted compression, such as the hands going through the hips.

In the sequences below, we have reduced the animation speed of the character to make it easier to see what problem the collision masks can solve.




Adding a Deform Manager

The Deform Manager component works as a link between Unreal and the Deform Dynamics physics engine. The manager retrieves information about the scene in Unreal, and sends it to the physics engine. The physics engine then sends the updated information back to the manager, which delegates it out to the objects which have been affected by the simulation.

  1. Go to the Place mode in the Modes window.
  2. Search for Deform Manager in the search bar and drag it into the scene.
  3. Alternatively, Navigate to DeformPlugin C++ Classes > Deform Plugin > Public in the Content Browser and drag the Deform Manager into the scene.
  4. The manager is initialized with a set of default parameters that you can use. Since the mesh we are going to simulate does not contain triangles of uniform size, we will enable Surface Sampling in the manager. If you want to change other parameters, there is more information here: Deform Manager actor.

Adding a Mesh Collider

The mesh collider creates a way for the deformable objects to interact with meshes in the Unreal Engine. It uses the triangle information of the mesh in order to do so.

  1. Navigate to DeformPlugin Content > Characters > Walking2 in the Content Browser and drag the animation sequence female_walking_Anim into the scene. Note that this is a different animation than in the previous tutorial, where the hands go inside the body, for demonstrative purposes.
  2. In the female_walking_Anim details, set the location to (256, 0, 20) and the rotation to (0, 0, 90).
  3. Press the Add Component button and search for Deform Mesh Collider and add it.
  4. Select the Deform Mesh Collider component that you just added to the actor.
  5. Set the Kinetic Friction to 0.4, and the Static Friction to 0.8.
  6. Set the Bias to 0.0075.
  7. Enable Should Remesh and set Num Remeshed Vertices to 6000.

Adding a Deform Body

The Deform Body component specifies which meshes should be added to the simulation. It also takes care of the updating of the procedural mesh which is used to visualize the results provided by the engine.

  1. Navigate to DeformPlugin Content > Meshes in the Content Browser and drag the mesh asymmetric into the scene.
  2. In the asymmetric details, set the location to (215, 22, 129), the rotation to (0, 0, 90), and the scale to (1.1, 1.1, 1.1). It is important that the simulation starts from a position where the cloth is adequately placed around the character.
  3. Set the material to blueMaterial.
  4. Press the Add Component button and search for Deform Body Component and add it.

Painting friction

To prevent some parts of the cloth from sliding too much, one can use the vertex paint editor to paint higher friction values. This can be useful when you have a thin shoulder strap, like in this case.

  1. With the asymmetric object selected, press the Deform Paint mode in the Modes window.
  2. Select Kinetic Friction in the drop-down menu.
  3. Set the coefficient to 0.8.
  4. Move the mouse over the shoulder strap of the garment while holding the Left Ctrl key down.

Painting collision masks on the cloth

If you run the simulation at this point, you will get a result similar to the left sequence at the start of this tutorial. Therefore we need to paint collision masks to filter out collisions between the hands and the dress.

  1. With the asymmetric object selected, press the Deform Paint mode in the Modes window.
  2. Select External Collision Masks in the drop-down menu. External means that the masks will affect the collisions against the mesh collider.
  3. Set the color to Blue.
  4. Press Fill to use the blue collision mask on the entire garment.

Painting collision masks on the mesh collider

In the previous step, we painted the garment with a blue collision mask, therefore the garment will only collide with Blue and White collision masks. Now, if we paint parts of the character in any other color, those parts will not collide with the cloth.

  1. With the female_walking_Anim object selected, press the Deform Paint mode in the Modes window.
  2. Select Collision mask mesh collider in the drop-down menu.
  3. Set the color to Red.
  4. Move the mouse over the hands of the character while holding the Left Ctrl key down to paint the hands red. If you cannot paint some parts due to the character pose, you can fiddle with the Initial Position parameter in the SkeletalMeshComponent of the character.

Running the simulation

  1. Press play in the Unreal editor.


The result from following this tutorial can be found here: DeformPlugin Content > Levels > Tutorials > ClothedCharacterCollisionMasks.

Simulating complex meshes

This tutorial describes how to use the Deform Mapping Component. It can be used to map any mesh to follow a simulated mesh. For example a high-resolution version of a garment to a lower resolution version, which is more adapted for simulation. Or a double-sided mesh, that has a thickness, can be effectively simulated in this way. This requires that you have two versions of the meshes, one for rendering and one for simulation. In this tutorial, we will be simulating a hoodie that consists of 33 000 vertices and has thickness, by mapping this mesh to a lower resolution version which is more adapted for simulation. We recommend that you inspect both meshes, which are included in the plugin, thoroughly to see the difference. Please note that the two versions of the cloth must be superimposed very carefully for the mapping to give good results.




Adding a Deform Manager

The Deform Manager component works as a link between Unreal and the Deform Dynamics physics engine. The manager retrieves information about the scene in Unreal, and sends it to the physics engine. The physics engine then sends the updated information back to the manager, which delegates it out to the objects which have been affected by the simulation.

  1. Go to the Place mode in the Modes window.
  2. Search for Deform Manager in the search bar and drag it into the scene.
  3. Alternatively, Navigate to DeformPlugin C++ Classes > Deform Plugin > Public in the Content Browser and drag the Deform Manager into the scene.

Adding a Mesh Collider

The mesh collider creates a way for the deformable objects to interact with meshes in the Unreal Engine. It uses the triangle information of the mesh in order to do so.

  1. Navigate to DeformPlugin Content > Characters > MaleAPose in the Content Browser and drag the Skeletal Mesh male_a-pose into the scene. Note that this tutorial doesn't use an animation.
  2. In the male_a-pose details, set the location to (239.5, 0, 20) and the rotation to (-90, 0, 90).
  3. Press the Add Component button and search for Deform Mesh Collider and add it.
  4. Select the Deform Mesh Collider component that you just added to the actor.
  5. Set the Kinetic Friction to 0.4, and the Static Friction to 0.8.
  6. Set the Bias to 0.0075.
  7. Enable Should Remesh and set Num Remeshed Vertices to 6000.

Adding a Deform Body

The Deform Body component specifies which meshes should be added to the simulation. It also takes care of the updating of the procedural mesh which is used to visualize the results provided by the engine.

  1. Navigate to DeformPlugin Content > Meshes > hoodie4 in the Content Browser and drag the mesh hoodie_for_simulation into the scene.
  2. In the hoodie_for_simulation details, set the location to (242.5, 0, 2.6) and the rotation to (90, 0, 90). It is important that the simulation starts from a position where the cloth is adequately placed around the character.
  3. Press the Add Component button and search for Deform Body and add it.
  4. In the Deform Body Component, uncheck the Visible parameter. This mesh will not be rendered, but only used by the Deform Mapper in the next step.

Adding a Deform Mapping

In this step, we will add the mesh which will be rendered. This mesh will be mapped to the simulated mesh added in the previous step, so that it follows the movements of the simulation.

  1. Navigate to DeformPlugin Content > Meshes > hoodie4 in the Content Browser and drag the mesh Hoodie into the scene.
  2. In the Hoodie details, set the location to (242.5, 0, 2.6) and the rotation to (0, 0, 90). When the Deform Mapper is initialized, it will create a mapping between itself and the deformable object it is mapped to. It is therefore very important that the two meshes are superimposed as close as possible for the mapping to be correct.
  3. Set the materials to (in falling order): Material3758, Fabric016 and Fabric026.
  4. Press the Add Component button and search for Deform Mapping and add it.
  5. In the Deform Mapping Component, set the Map To variable to be hoodie_for_simulation.

Running the simulation

  1. Press play in the Unreal editor.
  2. Note that the initialization might be a bit slow when using the mapper with complex meshes.


The result from following this tutorial can be found here: DeformPlugin Content > Levels > Tutorials > MappedHoodie. Note that we have also added an OrbitalCamera in this scene so that you can pick and interact with the cloth.

Additional scenes where the Deform Mapping Component can be found are: DeformPlugin Content > Levels > Demos > MappedObject0-3

Specifying cloth properties using textures

As an alternative to vertex painting, one can also assign per-vertex properties using textures. All properties which are paintable, are also available as texture parameters in the relevant components. In this tutorial, we will create a minimal example where 5 vertices of a patch are pinned.




Adding a Deform Manager

The Deform Manager works as a link between Unreal and the Deform Dynamics physics engine. The manager retrieves information about the scene in Unreal, and sends it to the physics engine. The physics engine then sends the updated information back to the manager, which delegates it out to the objects which have been affected by the simulation.

  1. Go to the Place mode in the Modes window.
  2. Search for Deform Manager in the search bar and drag it into the scene.
  3. Alternatively, Navigate to DeformPlugin C++ Classes > Deform Plugin > Public in the Content Browser and drag the Deform Manager into the scene.
  4. The manager is initialized with a set of default parameters that you can use. If you want to change the parameters, you can do it in the Deform Manager actor.

Adding a Deform Body

The Deform Body component specifies which meshes should be added to the simulation. It also takes care of the updating of the procedural mesh which is used to visualize the results provided by the engine.

  1. We have provided you with a low-resolution patch here. Download it and import it into your project.
  2. Add the imported mesh into your scene, change the location to (200, 0, 150), and the rotation to (0, 30, 0).
  3. Add a Deform Body Component to the actor you just created. This will tell the physics engine that this mesh should be simulated.
  4. Change the material to a two-sided material. You can use the materials in the DeformPlugin content, for example blueMaterial.

Using a texture to pin two vertices

The vertices of simple_patch.obj have UV coordinates. Since the patch consists of 29x29 vertices, a property can be assigned to each vertex by using a 29x29 texture. Here we show how to use a texture to pin 5 vertices.

  1. In the Deform Body Component, locate the parameter Pinned Texture and choose texture_tutorial. This texture can also be seen in the picture below.
  2. To understand what colors to use depending on what properties you want to assign to the vertices, please check Deform Body Component. In this case, of pinning vertices, white is considered unpinned, and black is considered pinned.




Running the simulation

  1. Press play in the Unreal editor.


The result from following this tutorial can be found here: DeformPlugin Content > Levels > Tutorials > PropertiesWithTextures.

Using the Deform Skinning Component

This tutorial describes how to use the skinning component to skin entire or parts of clothes to a character. You also have the option to blend between simulation and skinning using the skinning strength. This can be useful when having a very high energy motion that the collision system cannot handle.

The most important thing to consider when using the skinning component is that the skinning is calculated when the simulation is initialized. This means that the cloth and the character need to be aligned according to your need when using the skinning component. We will do this by using a mesh that is already deformed, and use the Base Mesh parameter of the Deform Body. Please examine the tutorial Saving a rest pose to see how we acquired the deformed mesh.




Adding a Deform Manager

The Deform Manager component works as a link between Unreal and the Deform Dynamics physics engine. The manager retrieves information about the scene in Unreal, and sends it to the physics engine. The physics engine then sends the updated information back to the manager, which delegates it out to the objects which have been affected by the simulation.

  1. Go to the Place mode in the Modes window.
  2. Search for Deform Manager in the search bar and drag it into the scene.
  3. Alternatively, Navigate to DeformPlugin C++ Classes > Deform Plugin > Public in the Content Browser and drag the Deform Manager into the scene.
  4. The manager is initialized with a set of default parameters that you can use. Since the mesh we are going to simulate does not contain triangles of uniform size, we will enable Surface Sampling in the manager. If you want to change other parameters, there is more information here: Deform Manager actor.

Adding a Mesh Collider

The mesh collider creates a way for the deformable objects to interact with meshes in the Unreal Engine. It uses the triangle information of the mesh to do so.

  1. Navigate to DeformPlugin Content > Characters > Walking in the Content Browser and drag the animation sequence female_walking_Anim into the scene.
  2. In the female_walking_Anim details, set the location to (250, 0, 20) and the rotation to (0, 0, 90).
  3. Press the Add Component button and search for Deform Mesh Collider and add it.
  4. Select the Deform Mesh Collider component that you just added to the actor.
  5. Set the Kinetic Friction to 0.2, and the Static Friction to 0.4.
  6. Set the Bias to 0.0095.
  7. Enable Should Remesh and set Num Remeshed Vertices to 8000.
  8. Change the name of the Deform Mesh Collider component to UniqueName. We will explain why in the upcoming sections.

Adding a Deform Body

The Deform Body component specifies which meshes should be added to the simulation. It also takes care of the updating of the procedural mesh which is used to visualize the results provided by the engine.

  1. Navigate to DeformPlugin Content > Meshes in the Content Browser and drag the mesh DeformedMesh into the scene.
  2. In the DeformedMesh details, set the location to (211, 21, 142) and the rotation to (345, 0, 90). It is important that the simulation starts from a position where the cloth is adequately placed around the character.
  3. Press the Add Component button and search for Deform Body Component and add it.
  4. In the Deform Body Component, change the Base Mesh to asymmetric, which is the original mesh that was used to produce DeformedMesh. It's this mesh rest values we want to use in the simulation. For more information about this, please see the tutorial Saving a rest pose.

Adding the Deform Skinning Component

Sometimes we want to skin parts of meshes to the character. This means that these skinned parts will follow the character exactly. However, the skinning strength can be used to blend between simulation and skinning. In this case, we will skin the shoulder strap to the character.

  1. Add a Deform Skinning Component to the DeformedMesh actor.
  2. In the Deform Skinning Component, enter the name of the Deform Mesh Collider that you want to skin to. This name must be unique. In our case, it is UniqueName. The Deform Skinning Component will scan the scene for a Deform Mesh Collider with this name. If there are multiple colliders with this name, it will choose the first one, and if there is no collider with this name, it will simply not skin.
  3. With the DeformedMesh object selected, press the Deform Paint mode in the Modes window.
  4. Select Skinning in the drop-down menu.
  5. Set the Skinning Strength to 0.5.
  6. Move the mouse over the shoulder strap of the garment while holding the Left Ctrl key down.

Running the simulation

  1. Press play in the Unreal editor.
  2. If you pick the strap by pressing RMB, and drag it a little bit, it will still move back to the shoulder. Please note that you need to add an Orbital Pawn or your own way of interacting with the cloth for this to work.
  3. If you paint the strap with a Skinning Strength of 1.0, the strap will not be pickable from the shoulder.


The result from following this tutorial can be found here: DeformPlugin Content > Levels > Tutorials > Skinning.