Check physics-purpose material bindings in USD decoder for contact properties - #3394
Check physics-purpose material bindings in USD decoder for contact properties#3394anishesg wants to merge 2 commits into
Conversation
…operties The USD decoder previously only checked default/all-purpose material bindings when importing colliders, missing physics-purpose material bindings that carry contact properties like friction, solref, solimp, margin, and gap. In USD, a collider can bind one material for visual appearance (default purpose) and a separate material for physics simulation (physics purpose). Signed-off-by: anish <anishesg@users.noreply.github.com>
|
I cloned this PR locally and built the USD decoder target with USD enabled: cmake --build /tmp/mujoco-pr3394-build --target usd_decoder_plugin --parallel 8It currently does not compile against the OpenUSD headers used by MuJoCo. The failure is in The relevant compiler error is: I also think the behavior should be a little more careful than only checking whether a physics-purpose material binding exists. A physics-purpose material can exist without actually authoring the physics/contact APIs, and in that case the decoder should still be able to fall back to the default/all-purpose material for physics/contact fields. I pushed a branch with the version I have been testing here: https://github.com/LouRohanNV/mujoco/tree/roundtrip-pr/usd-decoder-physics-materials The main differences in that branch are:
Maybe this PR could be updated in that direction, or we could use that branch as the basis for the final fix. |
… parsed physics APIs Signed-off-by: anish <anishesg@users.noreply.github.com>
|
ah good catch on the arg order, fixed. also switched to tracking whether physics APIs were actually parsed rather than just checking if the binding exists, and added separate caches like your branch. should compile now |
The USD decoder previously only checked default/all-purpose material bindings when importing colliders, missing physics-purpose material bindings that carry contact properties like friction, solref, solimp, margin, and gap. In USD, a collider can bind one material for visual appearance (default purpose) and a separate material for physics simulation (physics purpose).
The fix modifies
ParseUsdPhysicsColliderinplugin/usd_decoder/usd_decoder.ccto query physics-purpose material bindings before falling back to default bindings. When a physics-purpose binding exists with physics material APIs, the decoder now correctly extracts contact properties from that material. The default binding continues to provide visual material assignment. This ensures MJCF→USD→MJCF roundtrips preserve authored contact properties.Fixes #3393