Volume Deformable Object#
VolumeDeformableObject simulates a soft solid using a
tetrahedral mesh. Its simulation nodes carry world-frame positions and
velocities. Use a surface deformable for
geometry simulated as a triangle surface.
Use Newton on CUDA with a particle-capable solver and gradients disabled.
Declare the soft object before sim.prepare(). See
Newton Runtime Qualification for supported solver
and scene combinations.
Configuration#
VolumeDeformableObjectCfg separates the volume topology from
the material and contact settings.
Field |
Default |
Meaning |
|---|---|---|
|
|
Source surface mesh, or array-backed vertices for an explicit tetrahedral mesh. |
|
|
Optional USD input selected with |
|
|
Voxel resolution when building a tetrahedral mesh from a source surface. |
|
|
Render-to-volume embedding implementation for generated meshes. |
|
|
Explicit |
|
|
Contact radius per particle. Omission uses the solver default. |
|
|
Volume density in kg/m³. |
|
|
Young’s modulus in Pa. |
|
|
Poisson’s ratio, with a valid range of |
|
|
Volumetric damping. |
|
Zero coefficients, |
Optional surface forces and surface bending-edge constraints. |
A generated tetrahedral mesh has its own node order, so a per-node array
must follow the generated topology. For stable authored indices, supply
tetrahedra and array-backed shape.vertices. The vertices become the
simulation nodes in that order. The boundary is derived from the tetrahedra
when shape.triangles is omitted.
Use VolumeDeformableMeshingCfg to tune voxelization, surface
remeshing, simplification, and embedding. attrs.surface_props uses
SurfaceElementPropertiesCfg, with omitted coefficients
resolved to zero for volume descriptors. attrs.contact_material can specify
a DexUni per-object contact material on SDK builds that support it.
Setup & Initialization#
This headless example uses an explicit tetrahedron to keep the four simulation-node indices stable. The same configuration fields work with a larger explicit mesh.
from embodichain.lab.sim import SimulationManager, SimulationManagerCfg
from embodichain.lab.sim.cfg import (
NewtonPhysicsCfg,
RenderCfg,
VolumeDeformableObjectCfg,
VolumeDeformablePhysicsCfg,
)
from embodichain.lab.sim.shapes import MeshCfg
sim = SimulationManager(
SimulationManagerCfg(
headless=True,
physics_cfg=NewtonPhysicsCfg(
device="cuda:0", solver_cfg={"solver_type": "dexuni"}
),
render_cfg=RenderCfg(renderer="no-render"),
)
)
try:
soft = sim.add_deformable_object(
VolumeDeformableObjectCfg(
uid="soft_body",
init_pos=(0.0, 0.0, 0.5),
shape=MeshCfg(
vertices=[(0, 0, 0), (0.1, 0, 0), (0, 0.1, 0), (0, 0, 0.1)],
),
tetrahedra=[(0, 1, 2, 3)],
attrs=VolumeDeformablePhysicsCfg(youngs=1e5, poissons=0.4, density=75.0),
)
)
sim.prepare()
sim.update(step=1, render_final_step=False)
state = soft.data.nodal_state_w # (1, 4, 6)
finally:
sim.destroy(exit_process=False)
SimulationManager.flush_cleanup_queue()
For a file-backed mesh, set shape=MeshCfg(fpath="body.obj") and configure
meshing to control the generated tetrahedra. Use a closed surface that
encloses the desired volume.
Volume Deformable Object API#
Nodal State#
These properties return independent snapshots after preparation. E is the
instance count and V = soft.data.n_nodes.
Property |
Shape |
Meaning |
|---|---|---|
|
|
Simulation-node world positions and velocities. |
|
|
Position followed by velocity at each node. |
|
|
Initial state captured at binding. |
Use set_nodal_state(state, env_ids=...) to initialize a deformed state.
For example, the following compresses the prepared object in environment
zero along its world Z axis and sets its initial velocity to zero.
state = soft.data.default_nodal_state_w[0:1]
height = state[..., 2:3]
base_height = height.amin(dim=1, keepdim=True)
state[..., 2:3] = base_height + 0.9 * (height - base_height)
state[..., 3:] = 0
soft.set_nodal_state(state, env_ids=[0])
Use get_surface_vertices() and get_surface_triangles() for the rendered
surface. get_collision_surface_triangles() indexes the simulated body
nodes on its physical boundary.
Visual Material#
With native rendering, get_visual_material_inst() reports one
representative material or None per selected environment. Use
set_visual_material() for a replacement, and
restore_visual_material() to restore the source assignments.
Pose Management#
set_local_pose(pose, env_ids=...) places the captured rest shape at an
arena-local xyz + xyzw pose or 4×4 transform and zeros node velocities.
Use set_nodal_state() for a deformed initial shape. reset() restores
the configured placement and materials, while the nodal snapshots expose the
current shape.