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 in based on shape matching techniques and particle based 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 an virtual object and move it according the laws of physics. The object is not able to pass by another object and normally stops or drags around it or push 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 (the entire object or a part of it) or physically interact with it.
How-To¶
To create a soft body interaction, you need to attach the CreateDeformMesh
component onto the object you want to be deformable.
This gives you the following properties:
Particle grouping method selection
enum ParticleGroupMehod {distance, closest_point, distance_with_soft_interaction};
Type of particles collider
Mass per particle
Particles Angular drag
Particles resistance
Particles Division for grouping based on closest point
Particles creation distance for clustering
Particle affection range
Particles soft interaction distance
Particle scale selection
Simulate in local space
Center object scale
Use mesh collider for center selection
Enable self-collisions
Restrict soft body in a selected area based on collider
Explanation of Deformable Mesh properties¶
MAGES SDK offers three clustering algorithms.
1.1. Distance clusters the vertices only by finding the closest N vertices.
1.2. Closest Point, picks a vertex and group all the vertices that have the distance N into a particle.
1.3. Distance with Soft Interaction, group all vertices based on desired distance but a vertex can be stored also in different particles with weights.
The reason for implementing different clustering algorithms is because the vertices topology is different on meshes and only algorithm cannot serve all the different meshes.
The type of collider will be added to each soft-body particle.
Even though this field does not have a big effect when a lot particles are used, when their number is limited choosing a collider that fits the surface of the deformable mesh can lead to better visual results.
On each particle a rigidbody component is attached. The following rigidbody variables can be configured:
3.1. Mass
3.2. Angular Drag
Resistance is the force that each particle applies to the virtual hand. Higher resistance leads to less deformation.
The range that the particles will affect the vertices.
In case distance with soft interaction is selected the above value is discarded and this is used in a similar way.
The scale of the center particle which acts as a pivot point. By using a bigger center particle our algorithm will fill the surface of the object with deform-able particles.
Create a mesh collider and use it for particle calculation.
Warning
This is an extremely CPU intensive method and should be not be used lightly.
Enable collisions between particles.
Add restricting collider that specifies the area that particles will be spawned.
For 15. you need to create a SoftBodyRestriction gameObject and add a collider.
Then, you you can drag and drop the collider into the Bounds Collider property as in the image above.