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 click Add Component and navigate to MAGES → Mesh Deformations → Softbody.
Below there is a short description and the properties of the Mass Spring Softbody:
Mass Spring Softbody¶
MAGES SDK implements a MassSpring softbody simulation. It is suitable for all kinds of simulation both for skinned and static meshes, producing visually pleasing results.
Below are the properties of the script and what they do.
Property |
Description |
---|---|
|
The scale of each particle. |
|
The minimum distance two particles can be appart. |
|
The max distance of two connected particles. Increasing this value will increase realism in exchange for performance. It must be greater than |
|
The mass 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. |
|
Can the particles collide with each other?. |
|
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 maximum deformation the softbody can have. The maximum distance a particle can be from its anchor. |
|
The maximum distance a particle can be away from a vertex in order to affect it. |
|
The skinning function. |
|
The maximum number of particles a vertex can be affected from. |
Saving Utilities¶
All the skinning scripts have a tab called Saving Utilities. By selecting it you will a button in order to Save the softbodified mesh as an asset. Simply press it and choose a path in the project’s Assets directory as well as a suitable name to save the softbodified mesh as.
Network Limitations¶
Limitations¶
Due to the lack of an authoritative server in the system the MAGES SDK use, there are some limitations in the softbody interactions when in cooperative environments. The softbody physics will be handled by the machine of the client who last grabbed a particle of the softbody. The other clients will not be able to interact, until grabbing some particle and therefore taking authority of the simulation to their machine.
Setup¶
Warning
Photon PUN2 must first be imported, if not already done, in order to add network support. Use the MAGES Helper menu to import it.
In order to add multiplayer support to a softbody object simply press the Configure for Network button found at the end of the simulation script of the softbody.
In order to limit the network bandwidth you may increase the Movement and Rotation threshold of the MAGES Sync Transform Photon and the Net Multi Transform Photon script. Keep in mind that as you increase these values the more the max difference in transform the softbody may have between devices will be.