Beyond rigid bodies#
The Hello, Genesis World tutorial simulated a rigid robot. But a scene can hold water, sand, cloth, and soft tissue at the same time, because Genesis World unifies several physics solvers under one Scene. A solver is the set of algorithms that advances one family of materials; the material you assign to an entity decides which solver simulates it.
This page introduces the non-rigid solvers, explains when to reach for each, and links a runnable example per solver. It is an overview: read it to choose a solver, then follow the linked example for the full script.
Choosing a solver#
Every entity carries a material. In Hello, Genesis World the material defaulted to gs.materials.Rigid(), so the rigid solver handled the arm. Assign a material from a different family and its solver runs instead:
Solver |
Representation |
Reach for it when you need |
Materials ( |
|---|---|---|---|
MPM (Material Point Method) |
Hybrid particles + background grid |
The widest range of continuum materials in one solver: elastic, plastic, sand, snow |
|
FEM (Finite Element Method) |
Tetrahedral mesh |
Accurate elasticity and volumetric muscles, where mesh fidelity matters |
|
PBD (Position-Based Dynamics) |
Particles + constraints |
Fast cloth, ropes, and topology-preserving deformables |
|
SPH (Smoothed-Particle Hydrodynamics) |
Particles (Lagrangian) |
Free-surface liquids driven by real fluid parameters |
|
MPM and SPH also power particle emitters; MPM and FEM power volumetric soft robots.
MPM: deformable and granular materials#
The Material Point Method carries mass on particles while resolving forces on a background grid, which lets one solver span elastic solids, plastics, sand, and snow. Reach for MPM when you want several continuum behaviors in the same scene, or a material that flows and then holds its deformed shape.
Only the material differs between an elastic cube, a liquid cube, and an elastoplastic sphere:
scene.add_entity(material=gs.materials.MPM.Elastic(), ...)
scene.add_entity(material=gs.materials.MPM.Liquid(), ...)
scene.add_entity(material=gs.materials.MPM.ElastoPlastic(), ...)
Full script: examples/tutorials/mpm.py.
FEM: accurate elasticity and muscles#
The Finite Element Method discretizes an entity into a tetrahedral mesh and solves the elasticity equations on it. Choose FEM over MPM when mesh-level accuracy matters: stiff elastic bodies, volumetric muscles, and contact-rich soft-body manipulation. gs.materials.FEM.Elastic exposes the physical parameters directly, such as Young’s modulus E (Pa) and Poisson ratio nu.
FEM underpins the soft robots tutorial, which actuates a volumetric muscle. FEM entities also couple to rigid arms for grasping; see examples/coupling/fem_cube_linked_with_arm.py.
PBD: cloth and topology-preserving deformables#
Position-Based Dynamics represents an entity as particles linked by constraints and solves for positions directly, which makes it fast and stable for cloth, ropes, and other 1D/2D/3D bodies that keep their topology. gs.materials.PBD.Cloth loads a 2D mesh as a sheet.
You can pin individual particles after building. find_closest_particle locates the particle nearest a world-space point (meters), and fix_particles anchors it:
scene.build()
# pin all four corners of the sheet in place
cloth.fix_particles(cloth.find_closest_particle((-1, -1, 1.0)))
cloth.fix_particles(cloth.find_closest_particle((1, 1, 1.0)))
Full script: examples/tutorials/pbd_cloth.py.
Warning
Skinning a flat 2D cloth mesh with vis_mode="visual" can produce degenerate barycentric weights, which shows up as distorted rendering, especially with a non-zero euler. Use vis_mode="particle" for flat sheets until this is resolved.
SPH: free-surface liquids#
Smoothed-Particle Hydrodynamics is a purely Lagrangian (particle-only) solver aimed at liquids. Reach for SPH when you want fluid governed by physical parameters — rest density rho (kg/m³), viscosity mu, and surface tension gamma — rather than the coarser liquid model MPM provides.
Turning a rigid block into water is one line: give it an SPH liquid material. Tune the flow with its parameters:
liquid = scene.add_entity(
material=gs.materials.SPH.Liquid(), # or Liquid(mu=0.02, gamma=0.02) for a thicker fluid
morph=gs.morphs.Box(pos=(0.0, 0.0, 0.65), size=(0.4, 0.4, 0.4)),
surface=gs.surfaces.Default(color=(0.4, 0.8, 1.0), vis_mode="particle"),
)
Read live particle positions with liquid.get_particles_pos(), which returns a tensor of shape ([n_envs,] n_particles, 3) in meters.
Full script: examples/tutorials/sph_liquid.py.
Note
The Liquid material accepts a sampler that controls how particles fill the morph: "regular" (a grid lattice, the SPH default for numerical stability), "pbs" (physics-based sampling, which runs extra steps for a natural arrangement), or "random".
Next steps#
Soft robots: actuate MPM and FEM muscles.
Hybrid entities: couple a rigid skeleton to a soft skin.
Particle emitters: stream MPM, SPH, or PBD particles into a scene.
Solvers and coupling: how solvers exchange forces across material boundaries. Runnable pairings live in
examples/coupling, and the IPC contact solver for stiff soft-body contact inexamples/IPC_Solver.