Soft Bodies

The MAGES SDK supports real time soft bodies as a part of its standard features

Note

Soft bodies are used to simulate soft and deformable surfaces like the human skin, liquids, internal organs, cloths and any other deformable surfaces.

In this tutorial we will demonstrate how to setup the soft body behaviour on a human bowel model (small intestine).

Tutorial overview:

  1. Exporting the model from Maya

  2. Soft body setup

  3. General discusson

Exporting the model from Maya

The image below shows the bowel model in Maya.

../../../_images/bowel_maya1.png

This model has 5700 vertices. The number of vertices is really important in our soft body system both for the real-time simulation updates as well as the pre-load configuration and caching preprocessing time. Both operations (pre-processing and real-time updates) all depend heavily on the number of vertices under processing

Make sure to do a cleanup before exporting the FBX. In the cleanup window select the 4-sided faces, Faces with more than 4 slides and the Nonmanifold geometry.

../../../_images/bowel_maya_cleanup1.png

Then export the model using the FBX format.

Softbody setup

The first part is to create the Blueprint Actor that will serve have the softbody properties. Right click in your content browser, select blueprint class and make sure it inherits from the CreateDeformMesh class.

../../../_images/CreateDeformClass.png

Once you have selected which static mesh, you want to deform, add a static component to the new Blueprint and specify the 3D model that will be soft. For this example we will be using the intestine 3D model.

../../../_images/AddStaticComponent.png

In order for the softbody algorithm to be initialized we need also set the reference of the static mesh from the CreateDeformClass Actor. So, from the construction script of the blueprint we will set the Static Mesh variable. In this case the BaseMesh is the static mesh component added to our blueprint.

../../../_images/SetMesh.png

Configuring the SoftBody

In order to be able to simulate different types of softbodies MAGES provides 3 types of algorithms, as well as many configurable variables that developers can use to specify how the mesh will deform. On startup the CreateDeformMesh class will generate particles attached to vertices of the mesh which will be interactable and influence the mesh, deforming through physics. How many particles are generated, how dense they are, as well as how they influence the vertices is specified by the configuration of the CreateDeformMesh class.

These are the settings we used for the intestine model:

../../../_images/SoftBodiesSetup.png
  • The group method specifies how the particles will be grouped under each interactable item. Usually, the best results are achieve based on Distance_with_soft_interaction as it combines the two previous options.

  • The mesh property refers to the geometry of each particle. In this case we are using cubes.

  • The Particle Distance Layer refers to the distance between the particles. The higher the number the less particles will be generated.

  • The same principle applies for the Soft Interaction Distance.

  • Resistance and mass refers to how much each particle will influence the vertices to return back to their equilibrium.

As you can see in, the following picture, from the above configuration the following particles are generated in the scene.

../../../_images/GeneratedParticles.png

The above example can be found in the blueprint BP_SoftIntestine in the folder MAGES_SDK Content/MAGES/SDKAddons/SoftBodies

General discussion

Soft bodies introduce a powerful way to simulate deformable surfaces. The MAGES SDK offers a plug-and-play solution for particle-based soft bodies in Unreal, ideal for medical or any other use.

It is important to consider that real-time soft body simulation uses advanced physics algorithms to calculate the object’s movement per vertex, paying respect to its original shape. This is why you need to be extra careful with the script configuration as well as the model’s topology for best results.