Components

This page introduces the components provided by the Deform Plugin. These components are the means in which the user sets up the simulations and communicates with the underlying physics engine.

Deform Manager

The Deform Manager component works as a link between Unity and the Deform Dynamics physics engine. In the Deform Manager, the user can set global properties of the simulation. Fundamentally, the manager retrieves information about the scene in Unity, 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.

Please note that there should only be one Deform Manager per scene.


The Deform Manager contains the following parameters:


The Deform Manager component contains the following buttons:

Deform Body

The Deform Body component is used to define objects that should be simulated, such as cloths. All objects which have a Deform Body attached, will send the mesh data defined in the Mesh filter or Skinned Mesh Renderer to the simulation. The Deform Body requires a Mesh filter or a Skinned Mesh Renderer to be present in the same object. The Skinned Mesh Renderer should be used if you want the correct motion vectors when using Temporal anti-aliasing.


The Deform Body contains the following parameters:


The Deform Body component contains the following buttons:

Deform Body Volumetric

The Deform Body Volumetric component is used to create deformable bodies that preserve their volume, such as pillows. This component contains the same parameters as the Deform Body, as well as the ones presented in this section.


Deform Body Inflatable

The Deform Body Inflatable allows for creating deformable objects from closed meshes that can be inflated and deflated. This component contains the same parameters as the Deform Body, but also adds the Pressure scale parameter.



Inflatable object with varying pressure scale


Deform Patch Creator

The Deform Patch Creator component is a tool you can use to easily create a cloth patch, optimized for simulation. The Deform Patch Creator needs a Mesh filter and a Mesh Renderer component. If these components are not present in the GameObject, the patch creator will add them automatically. What the patch creator does is to fill the Mesh filter with a mesh of the properties specified in the parameters.


The Deform Patch Creator contains the following parameters:

The Deform Patch Creator component contains the following buttons:

Deform Collider

In this section, we will briefly explain the common functionality and parameters of the Deform colliders. The colliders can either be superimposed on an existing mesh in the scene, or they can show a simple mesh by themselves.

The following parameters are common for all Deform Colliders:

Please note that the colliders used in order to affect the simulated objects have the prefix Deform. You cannot use the built in Unity colliders to achieve collisions with the simulated objects. Furthermore, two-way interaction is currently not supported by the physics engine, meaning that the simulated objects will be affected by the colliders, but the colliders will not be affected by the simulated objects.

Implicit colliders

Deform Collider Box

The Deform Collider Box component can be used to simulate collisions against boxes. It can be created by right-clicking in the Hierarchy window, and navigate to Deform Dynamics > Deform Collider > Box.


The extents of the box collider are defined using the scale of the Transform component. Moving and rotating the box collider works as with any other GameObject. To increase the performance of the box collider, consider enabling Axis Aligned. Note that box colliders marked as axis aligned cannot be rotated.

To the left: The parameters of a box collider. To the right: A cloth falling upon a box collider.

Deform Collider Plane

The Deform Collider Plane component can be used to simulate collisions against infinite planes. It can be created by right-clicking in the Hierarchy window, and navigate to Deform Dynamics > Deform Collider > Plane.


The plane collider is defined only by its position and a normal. Moving the plane collider works as with any other GameObject, but rotating the collider also affects the normal of the plane.

To the left: The parameters of a plane collider. To the right: A plane collider with the normal tilting toward the camera, and a cloth falling upon it, slowly sliding down.

Deform Collider Sphere

The Deform Collider Sphere component can be used to simulate collisions against spheres. It can be created by right-clicking in the Hierarchy window, and navigate to Deform Dynamics > Deform Collider > Sphere.


The size of the sphere collider is determined by the size of the Radius parameter. Moving and rotating the sphere collider works as with any other GameObject.

To the left: The parameters of a sphere collider. To the right: A cloth falling upon a sphere collider.

Deform Collider Capsule

The Deform Collider Capsule component can be used to simulate collisions against capsules. It can be created by right-clicking in the Hierarchy window, and navigate to Deform Dynamics > Deform Collider > Capsule.




The capsule collider consists of three parts; two half-spheres at the ends and one cylinder between them. The shape and position of the capsule can be defined in one of two ways:

Which representation to choose depends on the context. If a capsule collider should follow two points that are moving, the Transforms representation is the most convenient one. For a static capsule or a capsule that should be moved via a script, the Length representation is more appropriate.

Top left: A capsule collider defined by the length. Top right: A capsule collider defined between two transform points. Bottom left: Example of a capsule collider defined with a length. Bottom right: Example of a capsule collider defined between two transform points, in this case, Empty game objects, with one manually moving.

Deform Collider Mesh

The Deform Collider Mesh component can be used to simulate collisions against triangular meshes. It can be added to any GameObject that has a Mesh filter or a Skinned Mesh Renderer.


To achieve the best possible results, the mesh should adhere to the following criteria:

  1. The triangles of the mesh should have approximately the same size.
  2. The mesh should not contain more than 6000-8000 vertices.
  3. The mesh should be closed and convex.
  4. It is very important that the vertex order is correct (CCW).
  5. The mesh cannot be too thin. The mesh has to have some volume.

If your mesh doesn't fulfill the first two criteria, the Use Proxy feature can be used to quickly generate a mesh that does. For more details see Remesher.


Example: A dress on a moving character. The Deform Collider Mesh component has been added to the GameObject containing the SkinnedMeshRenderer. A proxy mesh is used to improve performance.

Please refer to the tutorial Using the mesh collider for a more detailed explanation of how to use the mesh collider in practice.

Deform Seam

The Deform Seam component defines a number of vertices that should be sewed together, and how. It is created by clicking Create seam in the Sewing Editor. You can select it in the Hierarchy window. We recommend you to do the Sewing two patches together tutorial if you are interested in this component.


The Deform Seam component contains the following parameters:

Deform FBX Exporter

The Deform Exporter component makes it possible to record simulations and take snapshots. The results are stored in .fbx files, which can be imported in a variety of 3d programs, such as Autodesk 3ds Max and Blender. The animation will be saved to a point cache. In 3ds Max you can use the point cache modifier to import the animation. You can add the Deform Exporter to any GameObject containing a Deform Body or Deform Body Volumetric.


The Deform Exporter component contains the following functionality:

Please refer to the tutorial Exporting a simulation for a more detailed explanation of how to use the deform exporter in practice.

Deform Mesh Asset Generator

The Deform Mesh Asset Generator component makes it possible to save the current configuration of a cloth to a mesh asset file within your project. You can add the Deform Exporter to any GameObject containing a Deform Body or Deform Body Volumetric. This can be useful to quickly improve the initial configuration of clothed characters.


The Deform Mesh Asset Generator component contains the following functionality:

Please refer to the second part of the tutorial Saving and loading a garment configuration for a more detailed explanation of how to use the Deform Mesh Asset Generator in practice.

Deform Modifier Bend

This is a component to modify a mesh so that it is easier to sew around objects, such as arms or legs. It will manipulate the vertex positions of a mesh, in the same way as a common bend modifier works in other modeling tools. When a mesh is modified, and then simulated, the original rest values of the mesh will be used. This means that the bend modifier will not affect the simulation, only give a modified initial position more suited for certain types of situations.


The Deform Modifier Bend component contains the following functionality:

The Deform Modifier Bend component contains the following buttons:

Please refer to the tutorial Creating one-piece sleeves for a more detailed explanation of how to use the Deform Modifier Bend component in practice.

Deform Seam Importer

The Deform Seam Importer can be used to import seams exported from CLO/MD. This component should be added to a game object that already has a DeformBody. By pressing "Load seams" a DeformSeam object will be created and added to the scene. Note that this feature is experimental and will be changed in the future.


Deform Pattern

This is a component that is attached to patterns that are imported using the DXF-importer. The component triangulates a shape into triangles of the size specified. If the component detects a change in the pattern, such as scaling, it indicates that the triangulation can be redone, providing a better triangulation.


The Deform Exporter component contains the following functionality:

Deform Body Proxy

This component will exactly mimic the behavior of a Deform Body. This means that you can create proxies of the Deform Body, and place them anywhere in your scene without having to simulate multiple objects. Please note that you as a user have to add either Mesh filter and Mesh Renderer components or a Skinned Mesh Renderer component depending on what the source object uses. In short, if the source Deform Body uses a Mesh filter and Mesh Renderer to render the cloth, the proxy object also need to contain these components.


The Deform Body Proxy component contains the following parameters:

Please refer to the tutorial Using proxy meshes for a more detailed explanation of how to use the proxy object in practice.

Deform Skinning

This component can be added to a Deform Body component in order to skin the body or parts of it to a Deform Collider Mesh. The vertices of the Deform Body will then be mapped to the closest point on the mesh, and follow it's movements. This can be used to get a glue effect on parts of the cloth which should not slide too much, such as the end of sleeves or a dress in the waist.


The Deform Skinning component contains the following functionality:

Please refer to the tutorial Using skinning for a more detailed explanation of how to use skinning in practice.

Deform Picking

This component can be added to a Deform Body component in order to be able to pick and drag the cloth around. It can also limit how far away from the initial position the cloth can be pulled.


The Deform Picking component contains the following functionality:

Deform Mapping

This component makes it possible to map the vertices of any mesh to a Deform Body. This can for example be used to apply the motion of a simpler mesh to a more complex one that can't easily be simulated.


The Deform Mapping component can be added to any GameObject that has a MeshFilter or a SkinnedMeshRenderer. The only parameter is Map To, which is the DeformBody to map the given mesh to. To get the best result possible, the mesh should be carefully superimposed onto this DeformBody in the scene.

Editors

Here we list custom editors that can be used from the plugin.

Vertex paint editor

The vertex paint editor can be activated from several parts of the plugin. In order to paint friction or fixed vertices on the Deform Bodies, you can navigate to Deform Dynamics > Paint. If you want to paint collision masks, you have to activate the vertex paint editor from the Deform Body or Deform Collider Mesh you want the paint. Also, the Deform Skinning component utilizes the vertex paint editor to specify which vertices should be skinned.

When the vertex paint editor is active, it is exposed in the Scene view. Use your mouse cursor and left click to paint the vertices.



The vertex paint editor contains the following functionalities:



Example of when fixed vertices are painted using the vertex paint editor


It is possible to select multiple Deform Body objects and paint them simultaneously. To paint all objects in the scene, navigate to Deform Dynamics > Paint and select the type of data you would like to paint.

Sewing editor

The sewing mode is activated by navigating to Deform Dynamics > Sewing in the menu bar. To create a Deform Seam, the start and end-points, visualized as green and red spheres respectively, must be defined on the contour of the Deform Bodies that you want to sew together. This will form two lines (lines A and B). Between these two lines, the sewing will occur. When both the start and end-point has been set for the two lines, the seam is created by pressing the Create seam button. We recommend you to do the Sewing two patches together tutorial if you are interested in this functionality.


When sewing is active, a Sewing editor will be exposed in the lower right corner of the Scene view. The Sewing editor contains two modes: Vertex mode and Contour mode.



Remesher

To optimize the topology of a mesh for simulation, triangles of similar size and shape should be used. To generate a mesh with this kind of topology, open the DeformRemesher tool by selecting Deform > Remesh from the Unity Editor menu.




By changing the Remeshed vertex count parameter, you can decide to use a higher or lower resolution than the Input mesh. When pressing the Remesh button, a new mesh will be generated with the specified vertex count. To save the mesh to disk, set a filepath and press Save mesh asset. The resulting mesh can be used anywhere meshes can be used in Unity, for example as input to a DeformBody or a DeformColliderMesh.