Genesis icon indicating copy to clipboard operation
Genesis copied to clipboard

[Bug]: Depth camera does not render MPM soft bodies in parallel environments

Open ziqiao30 opened this issue 2 months ago • 2 comments

Bug Description

I found that when running Genesis with multiple environments (batched mode), the depth camera does not render MPM soft bodies. Rigid bodies appear correctly, but MPM objects are completely missing in the depth output.

This only happens when n_envs > 1. Depth rendering works as expected in single-environment mode.

Steps to Reproduce

import genesis as gs

gs.init(backend=gs.gpu)

scene = gs.Scene(
    renderer = gs.options.renderers.BatchRenderer(use_rasterizer=True)
)

# Add a simple MPM soft body
soft = scene.add_entity(
    material=gs.materials.MPM.ElastoPlastic(),
    morph=gs.morphs.Sphere(radius=0.1, pos=(0,0,0.3)),
)

# Add a rigid body to compare
rigid = scene.add_entity(gs.morphs.Box(size=(0.1,0.1,0.1)))

# Add a depth camera
cam = scene.add_camera(res=(640,480), pos=(1,0,1), lookat=(0,0,0))

scene.build(n_envs=4)   # ← Issue appears only when >1 env and using BatchRenderer

for _ in range(50):
    scene.step()
    depth = cam.render_depth()

Expected Behavior

MPM soft bodies should appear in depth images for all environments.

Environment

-Latest Genesis

-GPU backend

-Using BatchRenderer

-Soft body created with MPM material (ElastoPlastic)

-Depth camera added normally

Release version or Commit ID

59c4383

ziqiao30 avatar Nov 27 '25 22:11 ziqiao30

render_depth does not exist anymore. Can you check it is still buggy on latest main, and update your reproduction script accordingly?

duburcqa avatar Nov 27 '25 23:11 duburcqa

Hi, thanks for the fast follow-up!

I’ve updated to the latest main branch and re-checked the issue with a depth camera(depth_result = cam_depth.render(rgb=False, depth=True)) in a batched scene (BatchRenderer, n_envs >= 2). The behavior is still the same on my side:

With n_envs = 1, the depth image shows both the rigid objects and the MPM soft body correctly.

With n_envs >= 2, rigid objects still appear in the depth image, but the MPM soft body disappears.

Thanks again for looking into this!

ziqiao30 avatar Nov 28 '25 14:11 ziqiao30