Skip to content

Add emissive light mode to randomize_indirect_lighting#274

Merged
yuecideng merged 3 commits into
mainfrom
feat/randomize-indirect-lighting-emissive
May 20, 2026
Merged

Add emissive light mode to randomize_indirect_lighting#274
yuecideng merged 3 commits into
mainfrom
feat/randomize-indirect-lighting-emissive

Conversation

@yuecideng
Copy link
Copy Markdown
Contributor

Description

This PR extends randomize_indirect_lighting to support a new emissive light mode that is mutually exclusive with the existing HDR environment-map mode.

The functor now operates in one of two modes, enforced at initialisation:

  • HDR mode (existing): provide path → a random .hdr file is selected each call via set_indirect_lighting.
  • Emissive mode (new): provide emissive_color_range and/or emissive_intensity_range → color and intensity are sampled uniformly each call via set_emission_light.

Configuring both modes simultaneously, or neither, raises a ValueError with a descriptive message.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which improves an existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (existing functionality will not work without user modification)
  • Documentation update

Changes

  • embodichain/lab/gym/envs/managers/randomization/visual.pyrandomize_indirect_lighting rewritten with mutual-exclusivity enforcement; HDR mode returns early so emissive code never runs, and vice-versa.
  • tests/gym/envs/managers/test_event_functors.py — 11 new unit tests in TestRandomizeIndirectLighting covering init validation, HDR mode, and emissive mode; MockSim extended with set_indirect_lighting / set_emission_light stubs.
  • docs/source/overview/gym/event_functors.md — updated randomize_indirect_lighting entry to document both modes with JSON config examples.

Checklist

  • I have run the black . command to format the code base.
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • Dependencies have been updated, if applicable.

🤖 Generated with Claude Code

Extend `randomize_indirect_lighting` with a mutually exclusive emissive
light mode alongside the existing HDR mode.

**HDR mode** (unchanged): provide `path` to a folder of `.hdr` files; a
random file is selected each call via `set_indirect_lighting`.

**Emissive mode** (new): provide `emissive_color_range` and/or
`emissive_intensity_range`; values are sampled uniformly each call via
`set_emission_light`.

Configuring both modes simultaneously raises a `ValueError` at init.
Neither mode configured also raises a `ValueError`.

Changes:
- `randomize_indirect_lighting` functor rewritten to enforce mutual
  exclusivity with clear error messages
- 11 unit tests added to `test_event_functors.py` covering init
  validation, HDR mode behaviour, and emissive mode behaviour
- `MockSim` extended with `set_indirect_lighting` / `set_emission_light`
  stubs for testing
- `event_functors.md` updated to document both modes with JSON examples

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@yuecideng yuecideng added enhancement New feature or request gym robot learning env and its related features rendering Things related to rendering (eg, performace, efficiency, bug) docs Improvements or additions to documentation labels May 20, 2026
@yuecideng yuecideng merged commit 498dce9 into main May 20, 2026
6 of 12 checks passed
@yuecideng yuecideng deleted the feat/randomize-indirect-lighting-emissive branch May 20, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation enhancement New feature or request gym robot learning env and its related features rendering Things related to rendering (eg, performace, efficiency, bug)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant