Skip to content

Normalize Unity heightfield data before writing to MuJoCo - #3500

Open
sylvesterkaczmarek wants to merge 1 commit into
google-deepmind:mainfrom
sylvesterkaczmarek:fix/unity-hfield-height-normalization
Open

Normalize Unity heightfield data before writing to MuJoCo#3500
sylvesterkaczmarek wants to merge 1 commit into
google-deepmind:mainfrom
sylvesterkaczmarek:fix/unity-hfield-height-normalization

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor

Fixes #1930.

Summary

Unity heightfields with a maximum sample below 1 are currently scaled twice: the generated MuJoCo hfield size already uses the observed physical height range, while UpdateHeightFieldData() writes the original unnormalized samples into hfield_data.

This change:

  • records the minimum and maximum source heightmap values during preparation;
  • records MinimumHeight as well as MaximumHeight;
  • normalizes programmatic hfield_data samples to [0, 1] using that source range;
  • handles constant-height maps by writing zero normalized samples.

This keeps the MuJoCo heightfield data consistent with the physical range encoded in the generated hfield size.

Validation

  • Final diff: 1 file, +17/-5 lines, one commit, with no unrelated changes.
  • Branch is based on current upstream main at f7da3d295b828478e0171967a7fa3fe6bb2ec922.
  • No dedicated Unity heightfield regression test exists in the repository. Unity tests were not run locally in this environment, so upstream CI and maintainer validation are required.

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.

Wrong HField vertical scaling in unity plugin

1 participant