PBDSolver#
The PBDSolver implements Position Based Dynamics for simulating cloth, soft bodies, and particle systems with fast, stable performance.
Overview#
PBD works by:
Predicting particle positions
Projecting constraint violations
Iteratively correcting positions
Computing velocities from position change
Advantages:
Stability: Unconditionally stable
Speed: Fast iterative solving
Controllability: Direct position control
Supported Materials#
Material |
Description |
|---|---|
|
Cloth/fabric simulation |
|
Soft elastic bodies |
|
Particle systems |
|
Position-based fluids |
Usage#
import genesis as gs
gs.init()
scene = gs.Scene(
pbd_options=gs.options.PBDOptions(
iterations=10,
damping=0.99,
),
)
# Add cloth
cloth = scene.add_entity(
gs.morphs.Mesh(file="cloth.obj"),
material=gs.materials.PBD.Cloth(
stretch_stiffness=0.9,
bend_stiffness=0.1,
),
)
# Fix top edge
cloth.fix_vertices(y_max=0.99)
scene.build()
for i in range(1000):
scene.step()
Configuration#
Key options in PBDOptions:
Option |
Type |
Description |
|---|---|---|
|
int |
Constraint iterations |
|
float |
Velocity damping |
|
tuple |
Override gravity |
Constraint Types#
PBD uses various constraints:
Distance constraints: Maintain edge lengths
Bending constraints: Resist folding
Volume constraints: Preserve volume
Collision constraints: Handle contacts
Cloth Example#
cloth = scene.add_entity(
gs.morphs.Mesh(file="cloth.obj"),
material=gs.materials.PBD.Cloth(
stretch_stiffness=0.95, # Resist stretching
bend_stiffness=0.05, # Allow bending
thickness=0.01, # Collision thickness
),
)
See Also#
PBDEntity - PBD entities
PBD - PBD materials
gs.options.PBDOptions - Full options