Add support for separate occlusion, roughness and metallic textures
PiperOrigin-RevId: 775632047 Change-Id: I40ba0b3d4ecb0c0a03534b8d93f85d279febbc9c
This commit is contained in:
committed by
Copybara-Service
parent
81d16b7ccc
commit
da831f5d3e
@@ -166,56 +166,101 @@ TEST_F(MjcfSdfFileFormatPluginTest, TestMaterials) {
|
||||
stage, "/mesh_test/Materials/material_texture/diffuse.inputs:file",
|
||||
pxr::SdfAssetPath("textures/cube.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, TestMaterialLayers) {
|
||||
const std::string xml_path = GetTestDataFilePath(kMaterialsPath);
|
||||
auto stage = pxr::UsdStage::Open(xml_path);
|
||||
EXPECT_THAT(stage, testing::NotNull());
|
||||
|
||||
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,
|
||||
"/mesh_test/Materials/material_layered/"
|
||||
"PreviewSurface.inputs:normal",
|
||||
"/mesh_test/Materials/material_layered/normal.outputs:rgb");
|
||||
stage,
|
||||
"/mesh_test/Materials/material_layered/"
|
||||
"PreviewSurface.inputs:normal",
|
||||
"/mesh_test/Materials/material_layered/normal.outputs:rgb");
|
||||
ExpectAttributeEqual(
|
||||
stage, "/mesh_test/Materials/material_layered/normal.inputs:file",
|
||||
pxr::SdfAssetPath("textures/normal.png"));
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
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"));
|
||||
stage, "/mesh_test/Materials/material_layered/orm_packed.inputs:file",
|
||||
pxr::SdfAssetPath("textures/orm.png"));
|
||||
|
||||
EXPECT_PRIM_VALID(stage, "/mesh_test/Materials/material_layered/emissive");
|
||||
ExpectAttributeHasConnection(
|
||||
stage,
|
||||
"/mesh_test/Materials/material_layered/"
|
||||
"PreviewSurface.inputs:emissiveColor",
|
||||
"/mesh_test/Materials/material_layered/emissive.outputs:rgb");
|
||||
stage,
|
||||
"/mesh_test/Materials/material_layered/"
|
||||
"PreviewSurface.inputs:emissiveColor",
|
||||
"/mesh_test/Materials/material_layered/emissive.outputs:rgb");
|
||||
ExpectAttributeEqual(
|
||||
stage, "/mesh_test/Materials/material_layered/emissive.inputs:file",
|
||||
pxr::SdfAssetPath("textures/emissive.png"));
|
||||
stage, "/mesh_test/Materials/material_layered/emissive.inputs:file",
|
||||
pxr::SdfAssetPath("textures/emissive.png"));
|
||||
}
|
||||
|
||||
EXPECT_PRIM_VALID(stage, "/mesh_test/Materials/material_metallic");
|
||||
TEST_F(MjcfSdfFileFormatPluginTest, TestMaterialPBRSeparate) {
|
||||
const std::string xml_path = GetTestDataFilePath(kMaterialsPath);
|
||||
auto stage = pxr::UsdStage::Open(xml_path);
|
||||
|
||||
EXPECT_PRIM_VALID(stage, "/mesh_test/Materials/material_pbr_separate");
|
||||
EXPECT_PRIM_VALID(stage, "/mesh_test/Materials/material_pbr_separate/uvmap");
|
||||
EXPECT_PRIM_VALID(stage,
|
||||
"/mesh_test/Materials/material_metallic/PreviewSurface");
|
||||
ExpectAttributeEqual(stage,
|
||||
"/mesh_test/Materials/material_metallic/PreviewSurface.inputs:metallic",
|
||||
0.6f);
|
||||
"/mesh_test/Materials/material_pbr_separate/occlusion");
|
||||
ExpectAttributeHasConnection(
|
||||
stage,
|
||||
"/mesh_test/Materials/material_pbr_separate/"
|
||||
"PreviewSurface.inputs:occlusion",
|
||||
"/mesh_test/Materials/material_pbr_separate/occlusion.outputs:rgb");
|
||||
ExpectAttributeEqual(
|
||||
stage, "/mesh_test/Materials/material_pbr_separate/occlusion.inputs:file",
|
||||
pxr::SdfAssetPath("textures/occlusion.png"));
|
||||
EXPECT_PRIM_VALID(stage,
|
||||
"/mesh_test/Materials/material_pbr_separate/roughness");
|
||||
ExpectAttributeHasConnection(
|
||||
stage,
|
||||
"/mesh_test/Materials/material_pbr_separate/"
|
||||
"PreviewSurface.inputs:roughness",
|
||||
"/mesh_test/Materials/material_pbr_separate/roughness.outputs:rgb");
|
||||
ExpectAttributeEqual(
|
||||
stage, "/mesh_test/Materials/material_pbr_separate/roughness.inputs:file",
|
||||
pxr::SdfAssetPath("textures/roughness.png"));
|
||||
EXPECT_PRIM_VALID(stage,
|
||||
"/mesh_test/Materials/material_pbr_separate/metallic");
|
||||
ExpectAttributeHasConnection(
|
||||
stage,
|
||||
"/mesh_test/Materials/material_pbr_separate/"
|
||||
"PreviewSurface.inputs:metallic",
|
||||
"/mesh_test/Materials/material_pbr_separate/metallic.outputs:rgb");
|
||||
ExpectAttributeEqual(
|
||||
stage, "/mesh_test/Materials/material_pbr_separate/metallic.inputs:file",
|
||||
pxr::SdfAssetPath("textures/metallic.png"));
|
||||
}
|
||||
|
||||
TEST_F(MjcfSdfFileFormatPluginTest, TestGeomRgba) {
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
<texture name="normal_tex" file="textures/normal.png" type="2d" />
|
||||
<texture name="orm_tex" file="textures/orm.png" type="2d" />
|
||||
<texture name="emissive_tex" file="textures/emissive.png" type="2d" />
|
||||
<texture name="occlusion_tex" file="textures/occlusion.png" type="2d" />
|
||||
<texture name="roughness_tex" file="textures/roughness.png" type="2d" />
|
||||
<texture name="metallic_tex" file="textures/metallic.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"/>
|
||||
@@ -13,6 +16,11 @@
|
||||
<layer texture="orm_tex" role="orm"/>
|
||||
<layer texture="emissive_tex" role="emissive"/>
|
||||
</material>
|
||||
<material name="material_pbr_separate">
|
||||
<layer texture="occlusion_tex" role="occlusion"/>
|
||||
<layer texture="roughness_tex" role="roughness"/>
|
||||
<layer texture="metallic_tex" role="metallic"/>
|
||||
</material>
|
||||
2d texture="diffuse" normal="normal" />
|
||||
<mesh name="tetrahedron" vertex="0 0 0 1 0 0 0 1 0 0 0 1"/>
|
||||
</asset>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 480 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 480 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 480 KiB |
Reference in New Issue
Block a user