Simulation Assets#
Simulation assets in EmbodiChain are configured using Python dataclasses. This approach provides a structured and type-safe way to define properties for physics, materials and objects in the simulation environment.
Visual Materials#
Configuration#
The VisualMaterialCfg class defines the visual appearance of objects using Physically Based Rendering (PBR) properties.
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Unique identifier for the material. |
|
|
|
Base color/diffuse color (RGBA). |
|
|
|
Metallic factor (0.0 = dielectric, 1.0 = metallic). |
|
|
|
Surface roughness (0.0 = smooth, 1.0 = rough). |
|
|
|
Emissive color (RGB). |
|
|
|
Emissive intensity multiplier. |
|
|
|
Path to base color texture map. |
|
|
|
Path to metallic map. |
|
|
|
Path to roughness map. |
|
|
|
Path to normal map. |
|
|
|
Path to ambient occlusion map. |
|
|
|
Index of refraction for ray tracing materials. |
Visual Material and Visual Material Instance#
A visual material is defined using the VisualMaterialCfg class. It is actually a material template that can be used to create multiple instances with different parameters.
A visual material instance is created from a visual material using the method create_instance(). User can set different properties for each instance. For details API usage, please refer to the VisualMaterialInst documentation.
For batch simualtion scenarios, when user set a material to a object (eg, a rigid object with num_envs instances), the material instance will be created for each simulation instance automatically.
Code#
# Create a visual material with base color white and low roughness.
mat: VisualMaterial = sim.create_visual_material(
cfg=VisualMaterialCfg(
base_color=[1.0, 1.0, 1.0, 1.0],
roughness=0.05,
)
)
# Set the material to a rigid object.
object: RigidObject
object.set_visual_material(mat)
# Get all material instances created for this object in the simulation. If `num_envs` is N, there will be N instances.
mat_inst: List[VisualMaterialInst] = object.get_visual_material_inst()
# We can then modify the properties of each material instance separately.
mat_inst[0].set_base_color([1.0, 0.0, 0.0, 1.0])
Objects#
All objects inherit from ObjectBaseCfg, which provides common properties.
Base Properties
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Unique identifier. |
|
|
|
Position of the root in simulation world frame. |
|
|
|
Euler angles (in degrees) of the root. |
|
|
|
4x4 transformation matrix (overrides |
Rigid Object#
Configured via RigidObjectCfg.
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Shape configuration (e.g., Mesh, Box). |
|
|
|
Physical attributes. |
|
|
|
“dynamic”, “kinematic”, or “static”. |
|
|
|
Max convex hulls for decomposition (CoACD). |
|
|
|
Scale of the rigid body. |
Rigid Body Attributes#
The RigidBodyAttributesCfg class defines physical properties for rigid bodies.
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Mass in kg. Set to 0 to use density. |
|
|
|
Density in kg/m^3. |
|
|
|
Angular damping coefficient. |
|
|
|
Linear damping coefficient. |
|
|
|
Maximum depenetration velocity. |
|
|
|
Threshold below which the body can go to sleep. |
|
|
|
Enable continuous collision detection. |
|
|
|
Contact offset for collision detection. |
|
|
|
Rest offset for collision detection. |
|
|
|
Enable collision for the rigid body. |
|
|
|
Restitution (bounciness) coefficient. |
|
|
|
Dynamic friction coefficient. |
|
|
|
Static friction coefficient. |
For Rigid Object tutorial, please refer to the Create Scene tutorial.
Rigid Object Groups#
RigidObjectGroupCfg allows initializing multiple rigid objects, potentially from a folder.
Lights#
Configured via LightCfg.
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Type of light (currently only “point”). |
|
|
|
RGB color. |
|
|
|
Intensity in watts/m^2. |
|
|
|
Falloff radius. |