Deformable-Body Simulation

Overview

PhysX features GPU-accelerated finite-element-method (FEM) simulation that allows you to add deformable-body dynamics to mesh assets. As a simple example, compare a deformable-body to a rigid-body barrel:

You can create a deformable body from a mesh-geometry asset with the Add Button in the mesh’s property window: Choose Add > Physics > Deformable Body. This command not only adds the deformable-body component to the mesh, but also generates the collision and simulation tetrahedral (tet) meshes from the source mesh for the PhysX engine:

Deformable-body meshes

Note that we spatially separated the (usually co-located) meshes of the barrel, which are, from left to right:

  1. The visualization (i.e. the source asset) mesh.

  2. The collision tetmesh that PhysX uses to resolve collisions with other physics objects.

  3. The simulation tetmesh that PhysX uses to run the FEM simulation, and that drives both the collision and visualization meshes through an embedding, i.e. skinning. Note that it is not an issue that the generated simulation mesh is bigger than the visualization and collision meshes; this is typically the case.

The collision and simulation meshes above are the Debug Visualization for deformables that you can use to inspect the generated meshes. See the mesh simplification section in the component parameters for more information about the mesh generation.

The dynamics of the deformable body are configured in 1) the component parameters available in the Deformable Body rollout in the property window and 2) the Deformable-Body Material that you can create and bind to the deformable body (analogous to rigid-body materials).

Note

  • You cannot create compound deformable bodies analogous to compound rigid bodies. If you want to create a single deformable body from a set of source meshes, you need to first fuse the meshes with an external tool.

  • CPU simulation of deformable bodies is not supported, so you must have GPU simulation enabled in the Physics Scene (it is enabled by default).

Debug Visualization

You can enable visualization of the collision and simulation tetmeshes of the selected or all deformable bodies with the viewport show/hide options (the eye):

Deformable-body debug visualization

The gap size used for tetmesh visualization can be adjusted in the Deformable Debug Visualization rollout in the Physics Debug Window (Window > Simulation > Debug).

Deformable-Body Material

The material properties define, for example, how stiff the body will be with the Young’s Modulus, or the body’s dynamic friction against other objects. The steps to bind a material to a body are analogous to the rigid-body materials:

  1. Use Create > Physics > Physics Material, and create a new Deformable Body Material.

  2. Configure the material parameters - refer to the Tool Tips for further information.

  3. Bind the material to the deformable body (mesh) in the Physics Materials on Selected Objects rollout in its property window.

When a deformable body does not have a defined material, it will use default parameters that are identical to the parameters of a newly created deformable-body material. See also the Physics Material section for general physics material information.

Deformable-Body Component Parameters

In the Deformable Body rollout, you can configure parameters that mostly affect the PhysX FEM solver algorithm. We discuss a selection of the parameters and considerations below; for the remaining parameters, please refer to their Tool Tips for further information.

Solver Convergence

Two parameters that have an impact on solver convergence for a deformable body are the simulation-mesh resolution and the solver position iterations: The higher the resolution, the more solver iterations you typically need. Increasing the resolution may be necessary to capture finer details of the source visualization mesh.

We illustrate this in an example: The left barrel is created with default parameters; the right barrel has identical parameters, except that it has twice the simulation mesh resolution. The position iterations are left at their default value of sixteen.

The right, higher-resolution barrel appears to be softer, despite having the same Young’s Modulus, i.e. stiffness than the left barrel. This is because the default number of iterations are too low for the solver to converge for the higher complexity of the right barrel. You should be aware of the fact that sometimes, softness does not result from the material properties that you set, but may be caused by insufficient solver iterations that are applied. A good approach is to compare the behavior at different iteration counts when choosing an appropriate value. See also the note below about effective solver iterations when several physics objects are present in the scene.

Here is the same scene as above, but with four times more solver position iterations:

With the higher iteration count, we obtain better convergence and closer behavior of the identical-material but different-resolution barrels.

Note

  • The number of solver iterations that are applied to a deformable body depends on all objects in the scene that are not asleep, see the note in Sleeping.

  • A higher iteration count results in a higher computational load and will affect performance. Therefore, you should strike an appropriate balance between simulation fidelity and iteration count.

Collision Mesh Simplification

The asset visualization mesh is pre-processed by default when you create a deformable body. The preprocessing is designed to help generate tetmeshes that are well-suited for the simulation engine. The default pipeline is as follows:

  1. Remesh the input mesh by reconstructing its triangles on a voxel grid.

  2. Simplify the remeshed input mesh using quadric mesh simplification.

  3. Create the collision tetmesh from the simplified mesh.

  4. Create the voxel tetmesh from the collision tetmesh.

What each step does is illustrated in this two-dimensional example:

Deformable-body mesh simplification

You can fully parametrize the simplification pipeline:

Parameter

Description

Collision Mesh Simplification

Enables/disables both remeshing and simplification steps. If disabled, the input mesh is triangulated, if necessary, and then tetrahedralized to obtain the collision tetmesh.

Enable Remeshing

Enables/disables the remeshing step before simplification.

Remeshing Resolution

The voxel grid resolution used for remeshing; Autocomputed by default which determines an appropriate resolution from a heuristic. The autocomputed resolution is typically high; manually lowering the resolution may help removing unwanted details of the asset mesh, or with asset meshes that are not watertight.

Target Triangle Count

The target mesh resolution for quadric simplification; Autocomputed by default which determines an appropriate target count from a heuristic.

Self-Collision Filter Distance

If the initial, i.e. rest pose of the deformable body results in undesired self-collisions affecting behavior, adjust this parameter to slightly larger than two times the contact offset.

Attachments

A deformable body can be attached to primitives which have one of the following components:

  • Collider

  • Rigid Body

  • Deformable Body

Deformable Body - Collider/Rigid Body Attachments

Attachments between a Deformable Body and a Collider/Rigid Body can be created as follows:

  1. Move both primitives into an overlapping pose

  2. Select both primitives

  3. Create > Physics > Attachment

Posing Deformable-body for attaching to Collider

The attachment can be visualized using the show/hide menu in the Viewport:

Debug Visualization: Attachment Points (Pink) and Filter Tetrahedra (Cyan)

The debug visualization shows two elements of an attachment:

  • Attachment points (Pink)

  • Filtered tetrahedra (Cyan)

The filtering is needed to prevent collisions between tetrahedra of the deformable and the collider. Omitting filtering would result in jittering. Both attachment-point placement and filtering can be adjusted in the Compute Auto Attachment section of the attachment properties:

Controls to configure automatic generation of attachment points and filtering.

Parameter

Description

Attach Overlapping Vertices

Enables creating attachment points at collision-mesh-vertex locations. Vertices are attached if they are close to the collider volume.

Overlap Offset

Defines how close vertices need to be to the collider volume in order to be attached.

Attach Rigid Surface

Enables creating attachment points on the surface of the collider volume at locations that are contained by the volume defined by the deformable collision mesh.

Surface Sampling Distance

Distance at which collider-surface locations are sampled as attachment points.

Illustration of how attachment points are selected based on auto attachment computation parameter.

Collision Filtering

Enables collision filtering of deformable collision-mesh tetrahedra.

Filtering Offset

Defines at which distance to the collider volume filtering takes place.

Illustration of how filtered tetrahedra are selected based on auto attachment computation parameter.

Deformable Body - Deformable Body Attachments

Debug visualization of two attached Deformable Bodies.

Attachments between two Deformable Bodies can be created in the same way as attachments between Deformable Bodies and Colliders/Rigid Bodies. For deformable-deformable attachments, collision-mesh vertices of both deformables are considered. Only vertices that are contained in the intersection volume defined by both tetrahedral meshes are used as attachment points:

Illustration of which collision mesh vertices get selected as attachment points.

Note

  • The Overlap Offset parameter is not supported, as deforming locations outside of the deformable volume is ill-defined.

  • Both Attach Rigid Surface and Surface Sampling Distance are not supported.

  • Advanced/Enable Deformable Collision Filtering Pairs allows for exact pairwise tetrahedral collision filtering. If enabled, any part of one deformable can still collide with filtered parts of the other deformable if the parts are sufficiently distant in the rest pose. Depending on the geometry and the stiffness of the deformables this might be required, but usually it is not.