[BUG FIX] Fix heterogeneous entities in the Madrona batch renderer#2960
[BUG FIX] Fix heterogeneous entities in the Madrona batch renderer#2960Kashu7100 wants to merge 2 commits into
Conversation
video_old.mp4video_new.mp4 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12d4450d45
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| for vgeom in vgeoms: | ||
| if vgeom.active_envs_mask is not None: | ||
| geom_env_mask[:, vgeom.idx] = vgeom.active_envs_mask.detach().cpu().numpy() | ||
| args["geom_env_mask"] = geom_env_mask |
There was a problem hiding this comment.
Gate geom_env_mask on the installed Madrona API
In a default Linux install this repo still pins gs-madrona==0.0.7.post2 in pyproject.toml, while the renderer-side API that accepts geom_env_mask lives in a separate gs-madrona change. For any heterogeneous scene this line adds a new kwarg that the pinned MadronaBatchRenderer binding does not accept, so BatchRenderer.build() fails before rendering instead of preserving the previous behavior; please bump the dependency in this change or only emit the key when the installed adapter supports it.
Useful? React with 👍 / 👎.
Heterogeneous entities (objects whose geometry variant only exists in a subset of environments) were drawn in every environment by the Madrona batch renderer. Unlike the pyrender path fixed in Genesis-Embodied-AI#2958, the Madrona retriever already feeds dense per-env poses (`vgeoms_state.pos` -> [num_worlds, num_vgeoms]) and never compacts them, so the poses were already aligned -- the missing piece was per-environment visibility. `GenesisGeomRetriever.retrieve_rigid_meshes_static` now emits an optional `geom_env_mask` of shape [num_worlds, num_vgeoms] (1 = visible, 0 = hidden) built from each vgeom's `active_envs_mask`. This is the Madrona analog of the `active_envs` mask added to the pyrender rasterizer in Genesis-Embodied-AI#2958. The mask is omitted for homogeneous scenes, preserving legacy behavior and keeping back-compat with Madrona builds that do not yet accept it. Requires the matching gs-madrona change that consumes `geom_env_mask` (Genesis-Embodied-AI/gs-madrona#53). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
12d4450 to
e3f8641
Compare
|
🔴 Benchmark Regression Detected ➡️ Report |

Summary
Heterogeneous entities — objects whose geometry variant only exists in a subset of environments — were drawn in every environment by the Madrona batch renderer. This is the Madrona-path counterpart to #2958, which fixed the same class of bug in the pyrender rasterizer.
Root cause (and why it differs from #2958)
The pyrender fix in #2958 had two parts: (a) stop compacting per-env poses, and (b) add a per-
(primitive, env)active_envsvisibility mask.The Madrona retriever (
GenesisGeomRetriever.retrieve_rigid_state_torch) already feeds dense per-env poses —vgeoms_state.postransposed to[num_worlds, num_vgeoms]— and never compacts them, so part (a) is already correct here. The only missing piece is part (b): per-environment visibility. Without it, a variant vgeom that exists only in envs X, Y is still drawn in all worlds (the Madrona renderer draws every geom in every world).Change
GenesisGeomRetriever.retrieve_rigid_meshes_staticnow emits an optionalgeom_env_maskof shape[num_worlds, num_vgeoms](1= visible,0= hidden), built from each vgeom's existingactive_envs_mask(None⇒ active in all envs). This is the direct Madrona analog of theactive_envsmask added to the pyrender rasterizer in #2958.(world, geom)entries are simply masked out and never drawn / never enter the BVH.Dependency
Requires the matching renderer-side change in gs-madrona that consumes
geom_env_mask: Genesis-Embodied-AI/gs-madrona#53 (adds the optionalgeom_env_maskkwarg → per-(world, geom)renderable disable). With an older gs-madrona, the mask is only emitted for heterogeneous scenes, so homogeneous workloads are unaffected; heterogeneous scenes need both PRs.Testing / follow-up
py_compileclean; pre-commit (ruff) passes.test_render-style test mirroringtest_rasterizer_renders_heterogeneous_entitiesfrom [BUG FIX] Render each heterogeneous variant in its own environment. #2958 but driving the batch renderer (assert a variant only covers pixels in its active envs). Happy to add it.Note
Draft — opened for review of the approach alongside gs-madrona#53.
🤖 Generated with Claude Code