Soft Bodies¶
Introduction¶
Realistic deformations play an important role in computer graphics, games, simulations and VR environments.
Soft body simulations are used to change an object shape, when external forces are applied.
The computation of physically accurate deformation of objects when VR users uses hands controllers to interact is a liturgy, which requires much computation power. Only a few applications and simulations use soft body deformation due to computation power needed.
MAGES™ SDK & Soft bodies¶
In MAGES™ SDK, we provide a novel soft mesh deformation algorithm suitable for Virtual Reality interaction and collaboration.
The soft deformation algorithm is based on shape matching techniques and particle based spring mass soft body simulations. Our particle-based soft body algorithm is different from the state of the art because it provides easy control of the particles as physical objects and a center point, which controls the entire soft body position.
Velocity based interaction can be applied directly to our particles while as physical objects can interact also with the environment.
Our Virtual Reality interaction system uses velocity base approach providing the ability to pick up, hold and drop objects. Due to our soft body particles’ nature, this interaction can be applied directly.
Real time soft mesh deformations¶
With the use of term soft body, we mean a mesh that can change its initial vertices position when interacting with other physical meshes. Our main idea of creating a soft body physics algorithm is based on three main categories:
Clustering
The term clustering describes how each vertex on our mesh being grouped in another object that is used to calculate its deformation.
How physics are applied
For the soft bodies to achieve some deformation, physics should be applied. To apply physics in our soft bodies efficient and with good performance, we apply them to the clusters that we used to group all the vertices.
Mesh deformation
Finally, we have to calculate the mesh deformation. The resulting deformation derives from the Clustering transformation after the physics calculation. This transformation has an effect on our mesh vertices.
Soft bodies Interaction In VR¶
In virtual reality environments, the user can utilize hand controllers or other devices to interact with virtual objects. In this chapter, we provide a method on how this interaction can be performed based on physics properties.
We focus on how this interaction can be done by pickup and drop an object or physically interact with it. Then, we use this method to interact with our soft body mesh.
Pickup objects
With the use of VR controller, the user is able to pick a virtual object and move it according to the laws of physics. The object is not able to pass through another object and normally stops, slides around it or pushes it.
Physical interaction
The user is able to use the VR controllers to interact with object physically. For example, the user is able to push an object.
Interact with soft body
To interact with a soft body mesh, we use both of the above methods. The user is able to grab a soft body mesh or physically interact with it.
How-To¶
To create a soft body interaction, you need to select a softbody Simulation Method and attach it to the object you want to be deformable. You can select the most suitable by Clicking Add Component and navigating to MAGES → Physics → Softbodies.
As of right now we have 2 different simulation methods both supporting skinned and static meshes. Below there is a short description and the properties of each available method:
Spring Mass¶
This method is based on a spring mass particle simulation with shape matching constraints. It is suitable for all kinds of simulation both for skinned and static meshes, producing visually pleasing results. You can select this method by clicking Add Component, navigating to MAGES → Physics → Softbodies and choosing either SpringMass Softbody for static meshes, or Skinned SpringMass Softbody for skinned meshes.
SpringMass Softbody¶
This will attach 2 scripts to the object, the Softbody SpringMass (Responsible for the particle behavior) and the Softbody SpringMass Skinner (Responsible for deforming the mesh based on the particle positions). Below are the properties of each script and what they do.
Property |
Description |
---|---|
|
The mesh we want to softbodify. If not assigned this object’s mesh will be used. |
|
The material to use for the mesh. If left empty this object’s material will be used. |
|
A list of colliders representing the areas we do not want to make deformable. If left empty the whole mesh will be deformable. |
|
Visual debugging with gizmos for connections between particles while in editor. |
|
Visual debugging with gizmos for particle connections to the object’s center while in editor. |
|
The stiffness of the softbody springs. Increasing this value will make for a harder to deform object. |
|
The damper of the softbody springs. Decreasing this value will make for a more bouncy object. |
|
The spring tolerance. Large values will make for permanent deformations instead of elastic. |
|
The mass of each particle. |
|
The angular drag of each particle. |
|
Wheter to calculate the gavity per particle (when enabled) or to calculate it based on the rigidbody of the object’s center (when disabled). Leave disabled for increased simulation stability. |
PrimitiveType |
The collision shape of each particle. |
|
The global scale/radius of the particles. |
|
Can the particles collide with each other?. |
|
The maximum number of particles that can be generated. |
|
The minimum distance between two particles. Decreasing this value will increase realism in exchange for performance. |
|
The max distance of two connected particles. Increasing this value will increase realism in exchange for performance. It must be greater than |
Property |
Description |
---|---|
|
The mesh we want to softbodify. If not assigned this object’s mesh will be used. |
|
A list of colliders representing the areas we do not want to make deformable. If left empty the whole mesh will be deformable. |
|
Visual debugging with gizmos for the affected vertices of each particle. |
|
Visual debugging with gizmos for the affection radius of each particle with spheres. |
|
The way the particles will be attached to our softbody. Will they become children of the softbody ( |
|
The radius where the falloff will begin. Until that point the affection value will be 1. |
|
The radius where the falloff will end. |
|
The curve to use as falloff. |
|
If the falloff curve is set to |
Skinned SpringMass Softbody¶
This will attach 2 scripts to the object, the Softbody SpringMass (Responsible for the particle behavior) and the Softbody SpringMass Skinner (Responsible for deforming the mesh based on the particle positions). Below are the properties of each script and what they do.
Property |
Description |
---|---|
|
The mesh we want to softbodify. If not assigned this object’s mesh will be used. |
|
The material to use for the mesh. If left empty this object’s material will be used. |
|
A list of colliders representing the areas we do not want to make deformable. If left empty the whole mesh will be deformable. |
|
Visual debugging with gizmos for connections between particles while in editor. |
|
Visual debugging with gizmos for particle connections to the object’s center while in editor. |
|
The stiffness of the softbody springs. Increasing this value will make for a harder to deform object. |
|
The damper of the softbody springs. Decreasing this value will make for a more bouncy object. |
|
The spring tolerance. Large values will make for permanent deformations instead of elastic. |
|
The mass of each particle. |
|
The angular drag of each particle. |
|
Wheter to calculate the gavity per particle (when enabled) or to calculate it based on the rigidbody of the object’s center (when disabled). Leave disabled for increased simulation stability. |
PrimitiveType |
The collision shape of each particle. |
|
The global scale/radius of the particles. |
|
Can the particles collide with each other?. |
|
The maximum number of particles that can be generated. |
|
The minimum distance between two particles. Decreasing this value will increase realism in exchange for performance. |
|
The max distance of two connected particles. Increasing this value will increase realism in exchange for performance. It must be greater than |
Property |
Description |
---|---|
|
The mesh we want to softbodify. If not assigned this object’s mesh will be used. |
|
A list of colliders representing the areas we do not want to make deformable. If left empty the whole mesh will be deformable. |
|
Visual debugging with gizmos for the affected vertices of each particle. |
|
Visual debugging with gizmos for the affection radius of each particle with spheres. |
|
The way the particles will be attached to our softbody. Will they become children of the softbody ( |
|
The radius where the falloff will begin. Until that point the affection value will be 1. |
|
The radius where the falloff will end. |
|
The curve to use as falloff. |
|
If the falloff curve is set to |
Lightweight¶
This method is based on a spring mass particle simulation with shape matching constraints. It is suitable for all kinds of simulation both for skinned and static meshes, producing visually pleasing results. You can select this method by clicking Add Component, navigating to MAGES → Physics → Softbodies and choosing either SpringMass Softbody for static meshes, or Skinned SpringMass Softbody for skinned meshes.
Lightweight Softbody¶
This will attach 2 scripts to the object, the Softbody SpringMass (Responsible for the particle behavior) and the Softbody SpringMass Skinner (Responsible for deforming the mesh based on the particle positions). Below are the properties of each script and what they do.
Property |
Description |
---|---|
|
The mesh we want to softbodify. If not assigned this object’s mesh will be used. |
|
The material to use for the mesh. If left empty this object’s material will be used. |
|
A list of colliders representing the areas we do not want to make deformable. If left empty the whole mesh will be deformable. |
|
Increasing this will make the particles return faster to their original position and therefore the object will appear harder. |
|
The max distance from its original position each particle can go. If set to negative value the max distance limit is disabled. |
|
The mass of each particle. |
|
The drag of each particle. If the softbody is jittering then increase this value. |
|
The angular drag of each particle. |
|
Whether to calculate the gravity per particle (when enabled) or to calculate it based on the rigidbody of the object’s center (when disabled). Leave disabled for increased simulation stability. |
PrimitiveType |
The collision shape of each particle. |
|
The global scale/radius of the particles. |
|
Can the particles collide with each other?. |
|
The maximum number of particles that can be generated. |
|
The minimum distance between two particles. Decreasing this value will increase realism in exchange for performance. |
|
The max distance of two connected particles. Increasing this value will increase realism in exchange for performance. It must be greater than |
Property |
Description |
---|---|
|
The mesh we want to softbodify. If not assigned this object’s mesh will be used. |
|
A list of colliders representing the areas we do not want to make deformable. If left empty the whole mesh will be deformable. |
|
Visual debugging with gizmos for the affected vertices of each particle. |
|
Visual debugging with gizmos for the affection radius of each particle with spheres. |
|
The way the particles will be attached to our softbody. Will they become children of the softbody ( |
|
The radius where the falloff will begin. Until that point the affection value will be 1. |
|
The radius where the falloff will end. |
|
The curve to use as falloff. |
|
If the falloff curve is set to |
Skinned Lightweight Softbody¶
This will attach 2 scripts to the object, the Lightweight Softbody (Responsible for the particle behavior) and the Softbody Light Skinner (Responsible for deforming the mesh based on the particle positions). Below are the properties of each script and what they do.
Property |
Description |
---|---|
|
The mesh we want to softbodify. If not assigned this object’s mesh will be used. |
|
The material to use for the mesh. If left empty this object’s material will be used. |
|
A list of colliders representing the areas we do not want to make deformable. If left empty the whole mesh will be deformable. |
|
Increasing this will make the particles return faster to their original position and therefore the object will appear harder. |
|
The max distance from its original position each particle can go. If set to negative value the max distance limit is disabled. |
|
The mass of each particle. |
|
The drag of each particle. If the softbody is jittering then increase this value. |
|
The angular drag of each particle. |
|
Whether to calculate the gravity per particle (when enabled) or to calculate it based on the rigidbody of the object’s center (when disabled). Leave disabled for increased simulation stability. |
PrimitiveType |
The collision shape of each particle. |
|
The global scale/radius of the particles. |
|
Can the particles collide with each other?. |
|
The maximum number of particles that can be generated. |
|
The minimum distance between two particles. Decreasing this value will increase realism in exchange for performance. |
|
The max distance of two connected particles. Increasing this value will increase realism in exchange for performance. It must be greater than |
Property |
Description |
---|---|
|
The mesh we want to softbodify. If not assigned this object’s mesh will be used. |
|
A list of colliders representing the areas we do not want to make deformable. If left empty the whole mesh will be deformable. |
|
Visual debugging with gizmos for the affected vertices of each particle. |
|
Visual debugging with gizmos for the affection radius of each particle with spheres. |
|
The way the particles will be attached to our softbody. Will they become children of the softbody ( |
|
The radius where the falloff will begin. Until that point the affection value will be 1. |
|
The radius where the falloff will end. |
|
The curve to use as falloff. |
|
If the falloff curve is set to |
Saving Utilities¶
All the skinning scripts have a tab called Saving Utilities with the settings to save the mesh after initialization for further usage. Below are the options of that tab and what they do.
Property |
Description |
---|---|
|
The relative path from the project’s directory to the folder you want to save the mesh. |
|
The saved mesh’s name. |