Options system#
Genesis World is configured through options objects: small, typed parameter groups under gs.options.* that you pass to gs.Scene(...) and to scene.add_entity(...). Rather than a scene taking dozens of loose keyword arguments, each concern (the global simulator, one physics solver, the viewer, a renderer) gets its own object with its own defaults. This page explains what those objects are, how they compose into a scene, and how a setting given in two places is resolved.
If you have not built a scene yet, read Hello, Genesis World first. It uses SimOptions and ViewerOptions in passing. This page is the conceptual reference behind that usage.
A scene is assembled from options#
Every configurable component of a scene is described by one options object. You construct the objects you care about and hand them to the scene; anything you omit uses its defaults.
import genesis as gs
gs.init(backend=gs.gpu)
scene = gs.Scene(
sim_options=gs.options.SimOptions(dt=0.01, gravity=(0, 0, -9.81)),
rigid_options=gs.options.RigidOptions(enable_collision=True),
viewer_options=gs.options.ViewerOptions(
camera_pos=(3.5, 0.0, 2.5),
camera_lookat=(0.0, 0.0, 0.5),
camera_fov=40,
),
show_viewer=True,
)
The options split into three roles, plus a set of per-entity options passed to add_entity rather than to the scene:
Global.
SimOptionssets the properties of the simulation as a whole; coupler options set how solvers interact.Per solver. One options object per physics solver (rigid, MPM, SPH, FEM, SF, PBD), each configuring that solver alone.
Visualization. The viewer, solver-independent visualization, and the renderer.
Simulator options override solver options#
SimOptions holds settings that are global by default: most importantly the timestep dt (seconds) and gravity (N/kg, pointing down -Z). Each solver also exposes those same settings on its own options object, where they default to None.
The rule is: a value set on a solver’s options overrides the global SimOptions value, for that solver only. A solver whose field is left at None inherits the global value. This lets most scenes set dt once while allowing a single solver to run at a different rate.
scene = gs.Scene(
sim_options=gs.options.SimOptions(dt=0.01), # global timestep
rigid_options=gs.options.RigidOptions(dt=0.005), # rigid solver only, overrides the global dt
# mpm_options left unset -> the MPM solver, if used, inherits dt=0.01
)
The same inheritance applies to gravity. Settings that are meaningful only to one solver (for example RigidOptions.constraint_solver or RigidOptions.max_collision_pairs) live solely on that solver’s options and have no global counterpart.
Scene-level option groups#
Each of these is an optional argument to gs.Scene(...). Pass an instance to configure that component; omit it to accept the defaults.
Options class |
|
Configures |
|---|---|---|
|
Global timestep, gravity, substeps, differentiable mode. |
|
|
Coupling between solvers. Concrete variants: |
|
|
Rigid-body dynamics: contact, collision, constraints, integrator. |
|
|
Material Point Method solver (elastic, plastic, granular, fluid). |
|
|
Smoothed Particle Hydrodynamics solver (fluids, granular flow). |
|
|
Finite Element Method solver (elastic material). |
|
|
Stable Fluid solver (Eulerian gaseous simulation). |
|
|
Position-Based Dynamics solver (cloth, deformables, liquids, particles). |
|
|
Kinematic (non-dynamic) entities. |
|
|
Legacy tool solver. Slated for deprecation. |
|
|
Visualization independent of any viewer or camera. |
|
|
The interactive viewer: camera pose, resolution, refresh rate. |
|
|
Timing and FPS reporting. |
|
|
Rendering backend: |
The solver and coupler options are documented beside their solver and coupler in the physics engine reference, the global SimOptions under Scene, and the viewer, visualization, and renderer options in the visualization reference.
Note
Not every solver runs in every scene. A solver is only active once you add an entity whose material targets it: adding a rigid entity activates the rigid solver, and so on. Options for an inactive solver are simply unused.
Per-entity options#
add_entity takes its own options describing a single entity rather than the scene:
franka = scene.add_entity(
morph=gs.morphs.MJCF(file="xml/franka_emika_panda/panda.xml"),
material=gs.materials.Rigid(),
surface=gs.surfaces.Default(),
)
Morph: the entity’s geometry and initial pose. See Hello, Genesis World for loading morphs and the morph API.
Material: how the entity responds to physical forces, and which solver simulates it. See Beyond rigid bodies.
Surface: how the entity looks when rendered. See Surfaces and textures.
See also#
Hello, Genesis World: the minimal scene that uses these options.
Visualization: the interactive viewer and command-line tools.
Rendering: cameras, image types, video, and rendering backends.
API Reference: each option class, documented with the component it configures.