Skip to content

feat: visual randomization for sim scenes and replay - #345

Open
juelg wants to merge 5 commits into
masterfrom
juelg/visual-randomization
Open

juelg wants to merge 5 commits into
masterfrom
juelg/visual-randomization

Conversation

@juelg

@juelg juelg commented Oct 13, 2026

Copy link
Copy Markdown
Contributor
  • VisualRandomizer for background, material and lighting; each is off by default and doesn't break replay of recorded episodes.
  • SimEnvCreatorConfig.visual_randomization applies the enabled randomizers when the env is created.
  • replay() and the CLI gain --variant <randomizers>:<multiplier>, --keep-original and --seed, e.g. --variant background+material:0.5.
  • Every randomized step stores its variant, seed and sampled settings in info["visual_randomization"].

juelg added 5 commits October 13, 2026 16:13
Adds VisualRandomizer, which modifies an MjSpec before compilation:
- background: attaches an external scene (e.g. a room) as static,
  collision-free visual geometry and strips ceilings and its lights
- material: overwrites materials or assigns new ones to geoms, with
  optional mesh replacements that carry texture coordinates
- lighting: replaces scene lights with sampled presets

Each randomizer has an enabled flag that defaults to off. The
randomizers never add joints, so the sim state layout stays compatible
with recorded episodes. Also adds a helper that writes box-projected
UVs for STL meshes.
SimEnvCreatorConfig gets a visual_randomization field. When set, the
enabled randomizers are applied to the composed scene in create_model,
seeded by the config seed. The sampled parameters are kept on the
ModelComposer for inspection.
replay() accepts a list of ReplayVariants. Each variant names the
randomizers applied together and a multiplier for the number of
copies per episode, where a fractional part selects a deterministic
subset of episodes. keep_original controls whether the unrandomized
episodes are replayed as well, so e.g. background:1 and
background+material:1 yield three times the source data.

Each copy gets a seed derived from the base seed, episode uuid,
variant and copy index. With variants, every recorded step stores the
variant, seed and sampled parameters in info["visual_randomization"].
Without variants the replay behaves as before.
Example: rcs replay data out --variant background:1 --variant background+material:0.5

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant