Skip to content

Fix optional attribute indices in msh2obj output - #3595

Open
HaokaiDing wants to merge 1 commit into
google-deepmind:mainfrom
HaokaiDing:fix/msh2obj-optional-attributes
Open

HaokaiDing wants to merge 1 commit into
google-deepmind:mainfrom
HaokaiDing:fix/msh2obj-optional-attributes

Conversation

@HaokaiDing

Copy link
Copy Markdown

Fixes #3594.

Legacy MSH files may omit normals and/or texture coordinates, but msh_to_obj always writes faces as v/vt/vn. The resulting OBJ then references attribute records that do not exist.

Select the face format from the attribute arrays present in the MSH:

  • positions only: v
  • positions and texture coordinates: v/vt
  • positions and normals: v//vn
  • all attributes: v/vt/vn

The new parameterized test writes real tetrahedral MSH files for all four combinations, checks face syntax and attribute counts, and loads both the MSH and OBJ through MuJoCo. The existing full-attribute mesh comparison is retained. Explicit face assertions are necessary because MuJoCo's OBJ loader tolerates missing attribute arrays.

Validation:

  • Before the fix: three missing-attribute cases fail; the complete-attribute case and existing roundtrip pass.
  • After the fix: all 5 tests pass.
  • The checkout CLI generated the expected face syntax for all 4 combinations.
  • Pyink, isort and git diff --check pass.

Local tests used the checkout converter/test file with the real MuJoCo 3.13.0 macOS wheel for model loading, Python 3.13.15 and NumPy 2.5.3. The loaded converter path was checked to point at the checkout. The wheel uses float64; the current C++ source tree, full binding suite and mjUSESINGLE build were not built or run locally. New assertions concern OBJ strings and integer counts.

@google-cla

google-cla Bot commented Sep 15, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

msh2obj emits face indices for absent normals and texture coordinates

1 participant