Soft Body Physics Simulation

Web Demo

Explore the soft body physics simulation and interact with deformable objects in real-time.

Description

I created a Soft Body Physics Simulation using JavaScript and Three.js, employing the Extended Position Based Dynamics (XPBD) method. This simulation aimed to realistically model the behavior of soft, deformable objects, allowing them to respond naturally to external forces, collisions, and deformations. The XPBD algorithm provided the stability required to maintain the physical integrity of the soft body, ensuring realistic simulations in a real-time environment.

  • Three.js Integration: Used Three.js to render the soft body in a 3D scene. The soft body was represented as a mesh of interconnected particles (vertices), where each particle’s position was updated based on the XPBD calculations.
    • Rendering: Enhanced the visual representation of the soft body using Physics-Based Rendering(PBR) and lighting, making the deformations visually clear and realistic.
  • XPBD Algorithm: Leveraged XPBD to simulate the physical properties of soft bodies. The algorithm iteratively resolved constraints to maintain the soft body’s shape while allowing for realistic deformation under force.
    • Volume Preservation: Implemented volume constraints to maintain the overall volume of the soft body during deformation, ensuring that the object compresses or expands in a physically plausible manner.
    • Edge Constraints: Applied constraints to the surface edges to manage the soft body’s external shape and simulate realistic surface interactions and collisions.
  • Optimization: Optimized the simulation for performance in a web environment by carefully managing the number of particles and constraints, ensuring smooth performance even on lower-end devices.

Result

The Soft Body Physics Simulation demonstrated highly realistic behavior of deformable objects, with accurate responses to applied forces and collisions. The simulation was effectively rendered in real-time, providing an interactive web-based experience that performed well across different platforms. The demo successfully showcased the potential of XPBD for creating lifelike soft body simulations in a browser environment.

References

Macklin, M., Müller, M., & Chentanez, N. XPBD: Position-Based Simulation of Compliant Constrained Dynamics.

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Scroll to Top