Add support for ORM maps in mujoco file format plugin

The ORM texture is a packed-channel map, with ambient occlusion in Red, roughness in Green, and metallic in Blue channel.

PiperOrigin-RevId: 772367369
Change-Id: I88a4dee2477daa1e3c0b00197bfbe2b276ba9937
This commit is contained in:
Google DeepMind
2025-06-17 01:44:17 -07:00
committed by Copybara-Service
parent e2e2932fe6
commit ea949f1cee
4 changed files with 104 additions and 23 deletions
@@ -161,6 +161,7 @@ TEST_F(MjcfSdfFileFormatPluginTest, TestMaterials) {
EXPECT_PRIM_VALID(stage, "/mesh_test/Materials/material_layered");
EXPECT_PRIM_VALID(stage, "/mesh_test/Materials/material_layered/uvmap");
EXPECT_PRIM_VALID(stage, "/mesh_test/Materials/material_layered/diffuse");
EXPECT_PRIM_VALID(stage, "/mesh_test/Materials/material_layered/normal");
ExpectAttributeHasConnection(
stage,
@@ -170,6 +171,33 @@ TEST_F(MjcfSdfFileFormatPluginTest, TestMaterials) {
ExpectAttributeEqual(
stage, "/mesh_test/Materials/material_layered/normal.inputs:file",
pxr::SdfAssetPath("textures/normal.png"));
EXPECT_PRIM_VALID(stage, "/mesh_test/Materials/material_layered/orm_packed");
ExpectAttributeHasConnection(
stage,
"/mesh_test/Materials/material_layered/"
"PreviewSurface.inputs:occlusion",
"/mesh_test/Materials/material_layered/orm_packed.outputs:r");
ExpectAttributeHasConnection(
stage,
"/mesh_test/Materials/material_layered/"
"PreviewSurface.inputs:roughness",
"/mesh_test/Materials/material_layered/orm_packed.outputs:g");
ExpectAttributeHasConnection(
stage,
"/mesh_test/Materials/material_layered/"
"PreviewSurface.inputs:metallic",
"/mesh_test/Materials/material_layered/orm_packed.outputs:b");
ExpectAttributeEqual(
stage, "/mesh_test/Materials/material_layered/orm_packed.inputs:file",
pxr::SdfAssetPath("textures/orm.png"));
EXPECT_PRIM_VALID(stage, "/mesh_test/Materials/material_metallic");
EXPECT_PRIM_VALID(stage,
"/mesh_test/Materials/material_metallic/PreviewSurface");
ExpectAttributeEqual(stage,
"/mesh_test/Materials/material_metallic/PreviewSurface.inputs:metallic",
0.6f);
}
TEST_F(MjcfSdfFileFormatPluginTest, TestGeomRgba) {
@@ -2,11 +2,14 @@
<asset>
<texture name="diffuse_tex" file="textures/cube.png" type="2d" />
<texture name="normal_tex" file="textures/normal.png" type="2d" />
<texture name="orm_tex" file="textures/orm.png" type="2d" />
<material name="material_red" rgba="0.8 0 0 1" />
<material name="material_texture" texture="diffuse_tex" />
<material name="material_metallic" rgba="0.8 0 0 1" metallic="0.6"/>
<material name="material_layered">
<layer texture="diffuse_tex" role="rgb"/>
<layer texture="normal_tex" role="normal"/>
<layer texture="orm_tex" role="orm"/>
</material>
2d texture="diffuse" normal="normal" />
<mesh name="tetrahedron" vertex="0 0 0 1 0 0 0 1 0 0 0 1"/>
Binary file not shown.

After

Width:  |  Height:  |  Size: 480 KiB