布料#
gs.materials.FEM.Cloth 在 IPC 后端中使用基于壳的 FEM 公式来模拟布料、织物等薄壳。适用于服装、旗帜和薄膜等需要体现薄表面弯曲与拉伸的场景。
- class genesis.engine.materials.FEM.cloth.Cloth(*, use_visual_raycasting: bool = False, E: float = 10000.0, nu: float = 0.49, rho: float = 200.0, hydroelastic_modulus: float = 10000000.0, friction_mu: float = 0.1, contact_resistance: float | None = None, hessian_invariant: bool = False, build: Any = None, pre_compute: Any = None, update_stress: Any = None, compute_energy_gradient_hessian: Any = None, compute_energy_gradient: Any = None, compute_energy: Any = None, mu: float = 0.0, lam: float = 0.0, idx: int | None = None, thickness: float = 0.001, bending_stiffness: float | None = None, model: Literal['linear', 'stable_neohookean', 'linear_corotated'] = 'stable_neohookean') None[source]#
Cloth material for thin shell/membrane simulation using IPC.
This material is designed for cloth, fabric, and other thin flexible materials. It uses shell-based FEM formulation (NeoHookeanShell) in the IPC backend.
When used with FEMEntity, it signals to IPCCoupler that this entity should be treated as a 2D shell (cloth) rather than a 3D volumetric FEM object.
- Parameters:
E (float, optional) – Young’s modulus (Pa), controlling stiffness. Default is 1e4 (10 kPa).
nu (float, optional) – Poisson’s ratio, describing volume change under stress. Default is 0.49 (nearly incompressible).
rho (float, optional) – Material density (kg/m³). Default is 200 (typical fabric).
thickness (float, optional) – Shell thickness (m). Default is 0.001 (1mm).
bending_stiffness (float, optional) – Bending resistance coefficient. If None, no bending resistance. Default is None.
model (str, optional) – FEM material model (not used for cloth, kept for compatibility). Default is “stable_neohookean”.
friction_mu (float, optional) – Friction coefficient. Default is 0.1.
contact_resistance (float | None, optional) – IPC contact resistance/stiffness override.
Noneuses the IPC coupler global default. Default is None.
Notes
Only works with IPCCoupler enabled
Requires GPU backend
Only accepts surface mesh morphs (Mesh, etc.)
Uses FEMEntity infrastructure but simulated as 2D shell in IPC
Examples
>>> cloth = scene.add_entity( ... morph=gs.morphs.Mesh(file="cloth.obj"), ... material=gs.materials.FEM.Cloth( ... E=10e3, nu=0.49, rho=200, thickness=0.001, bending_stiffness=10.0 ... ), ... )