Skip to content

Conversation

@ft-lab
Copy link
Collaborator

@ft-lab ft-lab commented Dec 4, 2025

Description

Fixes #6

Convert OBJ to USD.

  • Supports multiple meshes in obj files

Updated:

If obj contains only one mesh, it will be processed using the same code as mujoco-usd-converter.

If obj contains multiple meshes, the multiple meshes will be placed in Xform.

two_meshes.obj

o Cube_Red
v 0.500000 0.300000 0.500000
...
o Cube_Green
v 0.500000 -1.300000 0.500000

->

two_meshes (Xform)
  Cube_Red (Mesh)
  Cube_Green (Mesh)

Checklist

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 97.46835% with 2 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
urdf_usd_converter/_impl/mesh.py 97.46% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Member

@andrewkaufman andrewkaufman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand the intricacies of mutli-object OBJs with respect to the tinyobjloader API, but I have found that many of the processing functions are quite slow. You need to be very careful about when & how to access the indices, normals, and texcoords arrays. If you do it subtly wrong you incur either array copies or per-index lookups between c++ & python, both of which are quite slow.

We should find the largest robot we can that has normals & uvs and perf test on that to figure out if our use of tinyobjloader is efficient.

If this does turn out to be slow, and there really is no other approach to split arrays between shapes, then we should have 2 code paths

  • fast path for single shape OBJs -- exactly what we have in MJC
  • slow path for multi shape OBJs

@ft-lab ft-lab force-pushed the dev/convert_obj_to_usd branch from fe3a0eb to 996a0d7 Compare December 5, 2025 06:48
@ft-lab ft-lab force-pushed the dev/convert_obj_to_usd branch from 996a0d7 to c78947e Compare December 5, 2025 06:58
@ft-lab ft-lab force-pushed the dev/convert_obj_to_usd branch from 7cc6cbb to aeb343b Compare December 9, 2025 05:46
@andrewkaufman andrewkaufman merged commit 88ab507 into newton-physics:main Dec 9, 2025
11 checks passed
@ft-lab ft-lab deleted the dev/convert_obj_to_usd branch January 16, 2026 01:01
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.

Convert OBJ Meshes to USD

2 participants