diff --git a/build_scripts/build_usd.py b/build_scripts/build_usd.py index 6d4e8feb05a..74fa7b443a1 100644 --- a/build_scripts/build_usd.py +++ b/build_scripts/build_usd.py @@ -1525,7 +1525,7 @@ def InstallDraco(context, force, buildArgs): ############################################################ # MaterialX -MATERIALX_URL = "https://github.com/materialx/MaterialX/archive/v1.38.10.zip" +MATERIALX_URL = "https://github.com/materialx/MaterialX/archive/v1.39.1.zip" def InstallMaterialX(context, force, buildArgs): with CurrentWorkingDirectory(DownloadURL(MATERIALX_URL, context, force)): diff --git a/pxr/imaging/hdMtlx/CMakeLists.txt b/pxr/imaging/hdMtlx/CMakeLists.txt index 1947b42f135..33746d0a9ed 100644 --- a/pxr/imaging/hdMtlx/CMakeLists.txt +++ b/pxr/imaging/hdMtlx/CMakeLists.txt @@ -20,3 +20,31 @@ pxr_library(hdMtlx PUBLIC_HEADERS api.h ) + +pxr_build_test(testHdMtlx + LIBRARIES + gf + tf + vt + geomUtil + pxOsd + hdMtlx + hdSt + usdImaging + CPPFILES + testenv/testHdMtlx.cpp +) + +pxr_install_test_dir( + SRC testenv/testHdMtlx + DEST testHdMtlx +) + +pxr_register_test(testHdMtlx + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testHdMtlx" + DIFF_COMPARE + out_StdSurface.mtlx + out_SwitchExample.mtlx + out_USD_Car_Paint.mtlx +# out_Atan2Example.mtlx +) diff --git a/pxr/imaging/hdMtlx/testenv/testHdMtlx.cpp b/pxr/imaging/hdMtlx/testenv/testHdMtlx.cpp new file mode 100644 index 00000000000..c99c50adf07 --- /dev/null +++ b/pxr/imaging/hdMtlx/testenv/testHdMtlx.cpp @@ -0,0 +1,235 @@ +// +// Copyright 2024 Pixar +// +// Licensed under the terms set forth in the LICENSE.txt file available at +// https://openusd.org/license. +// + +#include "pxr/base/tf/errorMark.h" +#include "pxr/usd/usd/stage.h" +#include "pxr/usd/usd/primRange.h" +#include "pxr/usd/usdShade/material.h" +#include "pxr/imaging/hd/dataSourceMaterialNetworkInterface.h" +#include "pxr/imaging/hd/renderIndex.h" +#include "pxr/imaging/hd/unitTestNullRenderDelegate.h" +#include "pxr/imaging/hdMtlx/hdMtlx.h" +#include "pxr/usdImaging/usdImaging/dataSourceMaterial.h" +#include "pxr/usdImaging/usdImaging/sceneIndices.h" +#include "pxr/usdImaging/usdImaging/stageSceneIndex.h" + +#include + +#include + +PXR_NAMESPACE_USING_DIRECTIVE + +namespace mx = MaterialX; + +class TestStageGlobals : public UsdImagingDataSourceStageGlobals { +public: + TestStageGlobals() : _time(0) {} + ~TestStageGlobals() override = default; + + UsdTimeCode GetTime() const override { return UsdTimeCode(_time); } + + void FlagAsTimeVarying(const SdfPath &hydraPath, + const HdDataSourceLocator &locator) const override { + _timeVarying[hydraPath].insert(locator); + } + + void FlagAsAssetPathDependent(const SdfPath &usdPath) const override { + _assetPathDependent.insert(usdPath); + } + + HdDataSourceLocatorSet const & + GetTimeVaryingLocators(SdfPath const &hydraPath) const { + return _timeVarying[hydraPath]; + } + + std::set const &GetAssetPathDependents() const { + return _assetPathDependent; + } + +private: + double _time; + mutable std::map _timeVarying; + mutable std::set _assetPathDependent; +}; + +// element predicate to remove includes added by importing standard library +bool elementPredicate(mx::ConstElementPtr elem) +{ + if (elem->hasSourceUri()) + { + return false; + } + return true; +} + + +void TestHdMtlx(const std::string& inputFilename, + const std::string& outputFilenamePrefix) { + UsdStageRefPtr stage = UsdStage::Open(inputFilename); + + UsdTimeCode frame(0); + Hd_UnitTestNullRenderDelegate renderDelegate; + std::unique_ptr renderIndex( + HdRenderIndex::New(&renderDelegate, HdDriverVector())); + + UsdImagingCreateSceneIndicesInfo info; + info.stage = stage; + const UsdImagingSceneIndices sceneIndices = UsdImagingCreateSceneIndices(info); + UsdImagingStageSceneIndexRefPtr stageSceneIndex = sceneIndices.stageSceneIndex; + stageSceneIndex->SetTime(frame); + + // NOTE: this makes assumptions based on scene index emulation and will + // need to be updated when HdRenderIndex no longer uses the + // emulated legacy APIs. + auto registeredSceneIndexNames = HdSceneIndexNameRegistry::GetInstance().GetRegisteredNames(); + if (registeredSceneIndexNames.size() != 1) { + std::cerr << "expecting 1 registered scene index (via emulation) and found " + << registeredSceneIndexNames.size() << " instead." << std::endl; + return; + } + + HdSceneIndexBaseRefPtr sceneIndex = + HdSceneIndexNameRegistry::GetInstance().GetNamedSceneIndex( + registeredSceneIndexNames[0]); + + if (!sceneIndex) { + std::cerr << "registered scene index is null." << std::endl; + return; + } + + std::string prefix = outputFilenamePrefix; + if (prefix.empty()) { + prefix = inputFilename; + } + + for (const auto& prim : stage->TraverseAll()) { + if (!prim.IsA()) { + continue; + } + + auto mtlSdfPath = prim.GetPath(); + std::string outputFilename = prefix+mtlSdfPath.GetName()+".mtlx"; + + TestStageGlobals stageGlobals; + auto imgPrim = UsdImagingDataSourceMaterialPrim::New( + mtlSdfPath, stage->GetPrimAtPath(mtlSdfPath), stageGlobals); + + auto mtlDataSource = imgPrim->Get(TfToken("material")); + HdContainerDataSourceHandle mtlDataSourceContainer = + HdContainerDataSource::Cast(mtlDataSource); + auto mtlxDataSource = mtlDataSourceContainer->Get(TfToken("mtlx")); + HdContainerDataSourceHandle mtlxDataSourceContainer = + HdContainerDataSource::Cast(mtlxDataSource); + + HdSceneIndexPrim hdPrim = sceneIndex->GetPrim(mtlSdfPath); + + auto hdNetwork = HdDataSourceMaterialNetworkInterface( + mtlSdfPath, mtlxDataSourceContainer, hdPrim.dataSource); + + auto terminalNames = hdNetwork.GetTerminalNames(); + if (terminalNames.empty()) { + std::cerr << "No terminals defined." << std::endl; + return; + } + + auto terminalNode = hdNetwork.GetTerminalConnection(terminalNames[0]); + if (!terminalNode.first) { + std::cerr << "No terminal node." << std::endl; + return; + } + + const mx::DocumentPtr &stdLibraries = HdMtlxStdLibraries(); + TfToken terminalNodeName = terminalNode.second.upstreamNodeName; + TfTokenVector terminalNodeConnectionNames = + hdNetwork.GetNodeInputConnectionNames(terminalNodeName); + + HdMtlxTexturePrimvarData *mxHdData = nullptr; + + MaterialX::DocumentPtr doc = + HdMtlxCreateMtlxDocumentFromHdMaterialNetworkInterface( + &hdNetwork, terminalNodeName, terminalNodeConnectionNames, + stdLibraries, mxHdData); + + mx::XmlWriteOptions writeOptions; + writeOptions.elementPredicate = [](mx::ConstElementPtr elem) -> bool { + // skip writing all includes for brevity + if (elem->hasSourceUri()) { + return false; + } + return true; + }; + + mx::writeToXmlFile(doc, outputFilename, &writeOptions); + } +} + +int main(int argc, char *argv[]) { + TfErrorMark mark; + + if (argc == 1) { + // standard cmake unit test run + // We are intentionally loading usd files here that hold UsdShade Materials + // representing MaterialX, instead of loading .mtlx files, because the UsdMtlx + // plugin can only create UsdShade network for the current MaterialX library + // version. + + // Test a case where no config:mtlx:version is specified. + TestHdMtlx("standard_surface_no_mtlx_version.usda", + "out_"); + + TestHdMtlx("usd_preview_surface_carpaint.usda", + "out_"); + + // Test a version where MaterialX actually has to mutate the data - switch + // used to only have 5 inputs but now has 10, so previously a 'which' of anything + // 5 or over acted like a 0, the MaterialX upgrade modifies those values to 0 + TestHdMtlx("switch_example.usda", + "out_"); + + // This atan2 test currently fails because HdMtlxCreateMtlxDocumentFromHdMaterialNetworkInterface() + // is unable to determine the correct type of the input ports, because their names have changed and + // thus the MaterialX lookup fails. + // I think we might need to update/extend _GetInputType() in hdMtlx.cpp to derive the correct MaterialX + // type using the data from HdNetwork - but perhaps not enough data is stored there currently? +// +// TestHdMtlx("atan2_example.usda", +// "out_"); + + } else { + // ad-hoc testing allows for passing options on the command line. + + std::string inputFilename = ""; + std::string outputFilenamePrefix = ""; + + for (int i = 0; i < argc; ++i) { + const std::string arg(argv[i]); + + if (arg == "--inputFilename") { + inputFilename = mx::FilePath(argv[++i]); + } else if (arg == "--outputFilenamePrefix") { + outputFilenamePrefix = mx::FilePath(argv[++i]); + } + } + + if (inputFilename.empty() ) { + std::cerr << "--inputFilename is required."; + return EXIT_FAILURE; + } + + TestHdMtlx(inputFilename, outputFilenamePrefix); + } + + TF_VERIFY(mark.IsClean()); + + if (mark.IsClean()) { + std::cout << "OK" << std::endl; + return EXIT_SUCCESS; + } else { + std::cout << "FAILED" << std::endl; + return EXIT_FAILURE; + } +} diff --git a/pxr/imaging/hdMtlx/testenv/testHdMtlx/atan2_example.usda b/pxr/imaging/hdMtlx/testenv/testHdMtlx/atan2_example.usda new file mode 100644 index 00000000000..b9c58bd44b5 --- /dev/null +++ b/pxr/imaging/hdMtlx/testenv/testHdMtlx/atan2_example.usda @@ -0,0 +1,81 @@ +#usda 1.0 +( + customLayerData = { + string colorSpace = "lin_rec709" + } +) + +def "MaterialX" +{ + def "Materials" + { + def Material "Atan2Example" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) + { + string config:mtlx:version = "1.38" + float inputs:clearcoat + float inputs:clearcoatRoughness + color3f inputs:diffuseColor = (0.10470402, 0.24188282, 0.818) + float inputs:displacement + color3f inputs:emissiveColor + float inputs:ior + float inputs:metallic + float3 inputs:normal + float inputs:occlusion + float inputs:opacity + float inputs:opacityThreshold + float inputs:roughness + color3f inputs:specularColor + int inputs:useSpecularWorkflow + token outputs:mtlx:surface.connect = + + def Shader "ND_UsdPreviewSurface_surfaceshader" ( + prepend references = + ) + { + float inputs:clearcoat.connect = + float inputs:clearcoatRoughness.connect = + color3f inputs:diffuseColor.connect = + float inputs:displacement.connect = + color3f inputs:emissiveColor.connect = + float inputs:ior.connect = + float inputs:metallic.connect = + float3 inputs:normal.connect = + float inputs:occlusion.connect = + float inputs:opacity.connect = + float inputs:opacityThreshold.connect = + float inputs:roughness.connect = + color3f inputs:specularColor.connect = + int inputs:useSpecularWorkflow.connect = + } + + def "NodeGraphs" ( + prepend references = + ) + { + } + } + } + + def "Shaders" + { + def Shader "ND_UsdPreviewSurface_surfaceshader" + { + uniform token info:id = "ND_UsdPreviewSurface_surfaceshader" + token outputs:surface + } + } + + def "NodeGraphs" + { + def Shader "atan2" + { + uniform token info:id = "ND_atan2_float" + float inputs:in1 = 0.2 + float inputs:in2 = 0.7 + float outputs:out + } + } +} + diff --git a/pxr/imaging/hdMtlx/testenv/testHdMtlx/baseline/out_Atan2Example.mtlx b/pxr/imaging/hdMtlx/testenv/testHdMtlx/baseline/out_Atan2Example.mtlx new file mode 100644 index 00000000000..009af6ea302 --- /dev/null +++ b/pxr/imaging/hdMtlx/testenv/testHdMtlx/baseline/out_Atan2Example.mtlx @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/pxr/imaging/hdMtlx/testenv/testHdMtlx/baseline/out_StdSurface.mtlx b/pxr/imaging/hdMtlx/testenv/testHdMtlx/baseline/out_StdSurface.mtlx new file mode 100644 index 00000000000..bd5823a3de1 --- /dev/null +++ b/pxr/imaging/hdMtlx/testenv/testHdMtlx/baseline/out_StdSurface.mtlx @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pxr/imaging/hdMtlx/testenv/testHdMtlx/baseline/out_SwitchExample.mtlx b/pxr/imaging/hdMtlx/testenv/testHdMtlx/baseline/out_SwitchExample.mtlx new file mode 100644 index 00000000000..400d273aca8 --- /dev/null +++ b/pxr/imaging/hdMtlx/testenv/testHdMtlx/baseline/out_SwitchExample.mtlx @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/pxr/imaging/hdMtlx/testenv/testHdMtlx/baseline/out_USD_Car_Paint.mtlx b/pxr/imaging/hdMtlx/testenv/testHdMtlx/baseline/out_USD_Car_Paint.mtlx new file mode 100644 index 00000000000..fb6d5bbc017 --- /dev/null +++ b/pxr/imaging/hdMtlx/testenv/testHdMtlx/baseline/out_USD_Car_Paint.mtlx @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/pxr/imaging/hdMtlx/testenv/testHdMtlx/standard_surface_no_mtlx_version.usda b/pxr/imaging/hdMtlx/testenv/testHdMtlx/standard_surface_no_mtlx_version.usda new file mode 100644 index 00000000000..cc00cfa2610 --- /dev/null +++ b/pxr/imaging/hdMtlx/testenv/testHdMtlx/standard_surface_no_mtlx_version.usda @@ -0,0 +1,112 @@ +#usda 1.0 + +def "MaterialX" +{ + def "Materials" + { + def Material "StdSurface" + { + float inputs:base = 0.2 + color3f inputs:base_color = (0.2, 0.4, 0.2) + float inputs:coat + float inputs:coat_affect_color + float inputs:coat_affect_roughness + float inputs:coat_anisotropy + color3f inputs:coat_color + float inputs:coat_IOR + float3 inputs:coat_normal + float inputs:coat_rotation + float inputs:coat_roughness + float inputs:diffuse_roughness + float inputs:emission + color3f inputs:emission_color + float inputs:metalness + float3 inputs:normal + color3f inputs:opacity + float inputs:sheen + color3f inputs:sheen_color + float inputs:sheen_roughness + float inputs:specular + float inputs:specular_anisotropy + color3f inputs:specular_color + float inputs:specular_IOR + float inputs:specular_rotation + float inputs:specular_roughness + float inputs:subsurface + float inputs:subsurface_anisotropy + color3f inputs:subsurface_color + color3f inputs:subsurface_radius + float inputs:subsurface_scale + float3 inputs:tangent + float inputs:thin_film_IOR + float inputs:thin_film_thickness + bool inputs:thin_walled + float inputs:transmission + color3f inputs:transmission_color + float inputs:transmission_depth + float inputs:transmission_dispersion + float inputs:transmission_extra_roughness + color3f inputs:transmission_scatter + float inputs:transmission_scatter_anisotropy + token outputs:mtlx:surface.connect = + + def Shader "ND_standard_surface_surfaceshader" ( + prepend references = + ) + { + float inputs:base.connect = + color3f inputs:base_color.connect = + float inputs:coat.connect = + float inputs:coat_affect_color.connect = + float inputs:coat_affect_roughness.connect = + float inputs:coat_anisotropy.connect = + color3f inputs:coat_color.connect = + float inputs:coat_IOR.connect = + float3 inputs:coat_normal.connect = + float inputs:coat_rotation.connect = + float inputs:coat_roughness.connect = + float inputs:diffuse_roughness.connect = + float inputs:emission.connect = + color3f inputs:emission_color.connect = + float inputs:metalness.connect = + float3 inputs:normal.connect = + color3f inputs:opacity.connect = + float inputs:sheen.connect = + color3f inputs:sheen_color.connect = + float inputs:sheen_roughness.connect = + float inputs:specular.connect = + float inputs:specular_anisotropy.connect = + color3f inputs:specular_color.connect = + float inputs:specular_IOR.connect = + float inputs:specular_rotation.connect = + float inputs:specular_roughness.connect = + float inputs:subsurface.connect = + float inputs:subsurface_anisotropy.connect = + color3f inputs:subsurface_color.connect = + color3f inputs:subsurface_radius.connect = + float inputs:subsurface_scale.connect = + float3 inputs:tangent.connect = + float inputs:thin_film_IOR.connect = + float inputs:thin_film_thickness.connect = + bool inputs:thin_walled.connect = + float inputs:transmission.connect = + color3f inputs:transmission_color.connect = + float inputs:transmission_depth.connect = + float inputs:transmission_dispersion.connect = + float inputs:transmission_extra_roughness.connect = + color3f inputs:transmission_scatter.connect = + float inputs:transmission_scatter_anisotropy.connect = + } + } + } + + def "Shaders" + { + def Shader "ND_standard_surface_surfaceshader" + { + uniform token info:id = "ND_standard_surface_surfaceshader" + token outputs:surface + } + } +} + diff --git a/pxr/imaging/hdMtlx/testenv/testHdMtlx/switch_example.usda b/pxr/imaging/hdMtlx/testenv/testHdMtlx/switch_example.usda new file mode 100644 index 00000000000..48db7d7b3aa --- /dev/null +++ b/pxr/imaging/hdMtlx/testenv/testHdMtlx/switch_example.usda @@ -0,0 +1,133 @@ +#usda 1.0 + +def "MaterialX" +{ + def "Materials" + { + def Material "SwitchExample" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) + { + string config:mtlx:version = "1.38" + float inputs:base + color3f inputs:base_color + float inputs:coat + float inputs:coat_affect_color + float inputs:coat_affect_roughness + float inputs:coat_anisotropy + color3f inputs:coat_color + float inputs:coat_IOR + float3 inputs:coat_normal + float inputs:coat_rotation + float inputs:coat_roughness + float inputs:diffuse_roughness + float inputs:emission + color3f inputs:emission_color + float inputs:metalness + float3 inputs:normal + color3f inputs:opacity + float inputs:sheen + color3f inputs:sheen_color + float inputs:sheen_roughness + float inputs:specular + float inputs:specular_anisotropy + color3f inputs:specular_color + float inputs:specular_IOR + float inputs:specular_rotation + float inputs:specular_roughness + float inputs:subsurface + float inputs:subsurface_anisotropy + color3f inputs:subsurface_color + color3f inputs:subsurface_radius + float inputs:subsurface_scale + float3 inputs:tangent + float inputs:thin_film_IOR + float inputs:thin_film_thickness + bool inputs:thin_walled + float inputs:transmission + color3f inputs:transmission_color + float inputs:transmission_depth + float inputs:transmission_dispersion + float inputs:transmission_extra_roughness + color3f inputs:transmission_scatter + float inputs:transmission_scatter_anisotropy + token outputs:mtlx:surface.connect = + + def Shader "ND_standard_surface_surfaceshader" ( + prepend references = + ) + { + float inputs:base.connect = + color3f inputs:base_color.connect = + float inputs:coat.connect = + float inputs:coat_affect_color.connect = + float inputs:coat_affect_roughness.connect = + float inputs:coat_anisotropy.connect = + color3f inputs:coat_color.connect = + float inputs:coat_IOR.connect = + float3 inputs:coat_normal.connect = + float inputs:coat_rotation.connect = + float inputs:coat_roughness.connect = + float inputs:diffuse_roughness.connect = + float inputs:emission.connect = + color3f inputs:emission_color.connect = + float inputs:metalness.connect = + float3 inputs:normal.connect = + color3f inputs:opacity.connect = + float inputs:sheen.connect = + color3f inputs:sheen_color.connect = + float inputs:sheen_roughness.connect = + float inputs:specular.connect = + float inputs:specular_anisotropy.connect = + color3f inputs:specular_color.connect = + float inputs:specular_IOR.connect = + float inputs:specular_rotation.connect = + float inputs:specular_roughness.connect = + float inputs:subsurface.connect = + float inputs:subsurface_anisotropy.connect = + color3f inputs:subsurface_color.connect = + color3f inputs:subsurface_radius.connect = + float inputs:subsurface_scale.connect = + float3 inputs:tangent.connect = + float inputs:thin_film_IOR.connect = + float inputs:thin_film_thickness.connect = + bool inputs:thin_walled.connect = + float inputs:transmission.connect = + color3f inputs:transmission_color.connect = + float inputs:transmission_depth.connect = + float inputs:transmission_dispersion.connect = + float inputs:transmission_extra_roughness.connect = + color3f inputs:transmission_scatter.connect = + float inputs:transmission_scatter_anisotropy.connect = + } + + def "NodeGraphs" ( + prepend references = + ) + { + } + } + } + + def "Shaders" + { + def Shader "ND_standard_surface_surfaceshader" + { + uniform token info:id = "ND_standard_surface_surfaceshader" + token outputs:surface + } + } + + def "NodeGraphs" + { + def Shader "switch" + { + uniform token info:id = "ND_switch_floatI" + float inputs:in1 = 0.2 + float inputs:in2 = 0.4 + int inputs:which = 5 + float outputs:out + } + } +} + diff --git a/pxr/imaging/hdMtlx/testenv/testHdMtlx/usd_preview_surface_carpaint.usda b/pxr/imaging/hdMtlx/testenv/testHdMtlx/usd_preview_surface_carpaint.usda new file mode 100644 index 00000000000..75fef2995bf --- /dev/null +++ b/pxr/imaging/hdMtlx/testenv/testHdMtlx/usd_preview_surface_carpaint.usda @@ -0,0 +1,64 @@ +#usda 1.0 +( + customLayerData = { + string colorSpace = "lin_rec709" + } +) + +def "MaterialX" +{ + def "Materials" + { + def Material "USD_Car_Paint" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) + { + string config:mtlx:version = "1.38" + float inputs:clearcoat = 1 + float inputs:clearcoatRoughness = 0 + color3f inputs:diffuseColor = (0.0518895, 0.29606, 0.425324) + float inputs:displacement + color3f inputs:emissiveColor + float inputs:ior + float inputs:metallic + float3 inputs:normal + float inputs:occlusion + float inputs:opacity + float inputs:opacityThreshold + float inputs:roughness = 0.4 + color3f inputs:specularColor + int inputs:useSpecularWorkflow + token outputs:mtlx:surface.connect = + + def Shader "ND_UsdPreviewSurface_surfaceshader" ( + prepend references = + ) + { + float inputs:clearcoat.connect = + float inputs:clearcoatRoughness.connect = + color3f inputs:diffuseColor.connect = + float inputs:displacement.connect = + color3f inputs:emissiveColor.connect = + float inputs:ior.connect = + float inputs:metallic.connect = + float3 inputs:normal.connect = + float inputs:occlusion.connect = + float inputs:opacity.connect = + float inputs:opacityThreshold.connect = + float inputs:roughness.connect = + color3f inputs:specularColor.connect = + int inputs:useSpecularWorkflow.connect = + } + } + } + + def "Shaders" + { + def Shader "ND_UsdPreviewSurface_surfaceshader" + { + uniform token info:id = "ND_UsdPreviewSurface_surfaceshader" + token outputs:surface + } + } +} + diff --git a/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/CustomNodeDef.usda b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/CustomNodeDef.usda index c4e6b0aa412..25458101523 100644 --- a/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/CustomNodeDef.usda +++ b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/CustomNodeDef.usda @@ -84,8 +84,11 @@ def "MaterialX" def "Materials" { - def Material "surface_material_node" + def Material "surface_material_node" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" float inputs:clearcoat float inputs:clearcoatRoughness color3f inputs:diffuseColor diff --git a/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/GraphlessNodes.usda b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/GraphlessNodes.usda index 19515599dc9..9e8e8203fde 100644 --- a/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/GraphlessNodes.usda +++ b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/GraphlessNodes.usda @@ -4,8 +4,11 @@ def "MaterialX" { def "Materials" { - def Material "surface_material_node" + def Material "surface_material_node" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" float inputs:clearcoat float inputs:clearcoatRoughness color3f inputs:diffuseColor diff --git a/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/Include.usda b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/Include.usda index e19a3164e07..ccc9eb4ac7e 100644 --- a/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/Include.usda +++ b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/Include.usda @@ -11,9 +11,11 @@ def "MaterialX" def "Materials" { def Material "Msimple" ( + prepend apiSchemas = ["MaterialXConfigAPI"] prepend variantSets = "vs_simple_srf" ) { + string config:mtlx:version = "1.39" color3f inputs:diffColor color3f inputs:otherColor1 color3f inputs:otherColor2 @@ -76,9 +78,11 @@ def "MaterialX" } def Material "Msimple2" ( + prepend apiSchemas = ["MaterialXConfigAPI"] prepend variantSets = "vs_simple_srf" ) { + string config:mtlx:version = "1.39" color3f inputs:diffColor color3f inputs:otherColor1 color3f inputs:otherColor2 @@ -107,8 +111,11 @@ def "MaterialX" } } - def Material "mheadlight" + def Material "mheadlight" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token inputs:custom ( renderType = "customtype" ) @@ -131,8 +138,11 @@ def "MaterialX" } } - def Material "mheadlight1" + def Material "mheadlight1" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token inputs:custom ( renderType = "customtype" ) @@ -159,8 +169,11 @@ def "MaterialX" } } - def Material "mheadlight2" + def Material "mheadlight2" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token inputs:custom ( renderType = "customtype" ) @@ -181,8 +194,11 @@ def "MaterialX" } } - def Material "m_vn" + def Material "m_vn" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn" ( @@ -192,8 +208,11 @@ def "MaterialX" } } - def Material "m_vn_1_0" + def Material "m_vn_1_0" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn2" ( @@ -203,8 +222,11 @@ def "MaterialX" } } - def Material "m_vn_nd_1_0" + def Material "m_vn_nd_1_0" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn3" ( @@ -214,8 +236,11 @@ def "MaterialX" } } - def Material "m_vn_2_0" + def Material "m_vn_2_0" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn4" ( @@ -225,8 +250,11 @@ def "MaterialX" } } - def Material "m_vn_2_1" + def Material "m_vn_2_1" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn5" ( @@ -236,8 +264,11 @@ def "MaterialX" } } - def Material "m_vn_nd_2x" + def Material "m_vn_nd_2x" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn6" ( diff --git a/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/Include_From_Usdz.usda b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/Include_From_Usdz.usda index e19a3164e07..ccc9eb4ac7e 100644 --- a/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/Include_From_Usdz.usda +++ b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/Include_From_Usdz.usda @@ -11,9 +11,11 @@ def "MaterialX" def "Materials" { def Material "Msimple" ( + prepend apiSchemas = ["MaterialXConfigAPI"] prepend variantSets = "vs_simple_srf" ) { + string config:mtlx:version = "1.39" color3f inputs:diffColor color3f inputs:otherColor1 color3f inputs:otherColor2 @@ -76,9 +78,11 @@ def "MaterialX" } def Material "Msimple2" ( + prepend apiSchemas = ["MaterialXConfigAPI"] prepend variantSets = "vs_simple_srf" ) { + string config:mtlx:version = "1.39" color3f inputs:diffColor color3f inputs:otherColor1 color3f inputs:otherColor2 @@ -107,8 +111,11 @@ def "MaterialX" } } - def Material "mheadlight" + def Material "mheadlight" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token inputs:custom ( renderType = "customtype" ) @@ -131,8 +138,11 @@ def "MaterialX" } } - def Material "mheadlight1" + def Material "mheadlight1" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token inputs:custom ( renderType = "customtype" ) @@ -159,8 +169,11 @@ def "MaterialX" } } - def Material "mheadlight2" + def Material "mheadlight2" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token inputs:custom ( renderType = "customtype" ) @@ -181,8 +194,11 @@ def "MaterialX" } } - def Material "m_vn" + def Material "m_vn" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn" ( @@ -192,8 +208,11 @@ def "MaterialX" } } - def Material "m_vn_1_0" + def Material "m_vn_1_0" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn2" ( @@ -203,8 +222,11 @@ def "MaterialX" } } - def Material "m_vn_nd_1_0" + def Material "m_vn_nd_1_0" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn3" ( @@ -214,8 +236,11 @@ def "MaterialX" } } - def Material "m_vn_2_0" + def Material "m_vn_2_0" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn4" ( @@ -225,8 +250,11 @@ def "MaterialX" } } - def Material "m_vn_2_1" + def Material "m_vn_2_1" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn5" ( @@ -236,8 +264,11 @@ def "MaterialX" } } - def Material "m_vn_nd_2x" + def Material "m_vn_nd_2x" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn6" ( diff --git a/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/Looks.usda b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/Looks.usda index e19a3164e07..ccc9eb4ac7e 100644 --- a/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/Looks.usda +++ b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/Looks.usda @@ -11,9 +11,11 @@ def "MaterialX" def "Materials" { def Material "Msimple" ( + prepend apiSchemas = ["MaterialXConfigAPI"] prepend variantSets = "vs_simple_srf" ) { + string config:mtlx:version = "1.39" color3f inputs:diffColor color3f inputs:otherColor1 color3f inputs:otherColor2 @@ -76,9 +78,11 @@ def "MaterialX" } def Material "Msimple2" ( + prepend apiSchemas = ["MaterialXConfigAPI"] prepend variantSets = "vs_simple_srf" ) { + string config:mtlx:version = "1.39" color3f inputs:diffColor color3f inputs:otherColor1 color3f inputs:otherColor2 @@ -107,8 +111,11 @@ def "MaterialX" } } - def Material "mheadlight" + def Material "mheadlight" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token inputs:custom ( renderType = "customtype" ) @@ -131,8 +138,11 @@ def "MaterialX" } } - def Material "mheadlight1" + def Material "mheadlight1" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token inputs:custom ( renderType = "customtype" ) @@ -159,8 +169,11 @@ def "MaterialX" } } - def Material "mheadlight2" + def Material "mheadlight2" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token inputs:custom ( renderType = "customtype" ) @@ -181,8 +194,11 @@ def "MaterialX" } } - def Material "m_vn" + def Material "m_vn" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn" ( @@ -192,8 +208,11 @@ def "MaterialX" } } - def Material "m_vn_1_0" + def Material "m_vn_1_0" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn2" ( @@ -203,8 +222,11 @@ def "MaterialX" } } - def Material "m_vn_nd_1_0" + def Material "m_vn_nd_1_0" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn3" ( @@ -214,8 +236,11 @@ def "MaterialX" } } - def Material "m_vn_2_0" + def Material "m_vn_2_0" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn4" ( @@ -225,8 +250,11 @@ def "MaterialX" } } - def Material "m_vn_2_1" + def Material "m_vn_2_1" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn5" ( @@ -236,8 +264,11 @@ def "MaterialX" } } - def Material "m_vn_nd_2x" + def Material "m_vn_nd_2x" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" token outputs:mtlx:surface.connect = def Shader "sr_vn6" ( diff --git a/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/usd_preview_surface_gold.usda b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/usd_preview_surface_gold.usda index c1feb635f29..22a2fe34cb7 100644 --- a/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/usd_preview_surface_gold.usda +++ b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/baseline/usd_preview_surface_gold.usda @@ -4,8 +4,11 @@ def "MaterialX" { def "Materials" { - def Material "USD_Gold" + def Material "USD_Gold" ( + prepend apiSchemas = ["MaterialXConfigAPI"] + ) { + string config:mtlx:version = "1.39" float inputs:clearcoat float inputs:clearcoatRoughness color3f inputs:diffuseColor = (0.944, 0.776, 0.373) diff --git a/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/open_pbr_ketchup.mtlx b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/open_pbr_ketchup.mtlx new file mode 100644 index 00000000000..b6f4f475214 --- /dev/null +++ b/pxr/usd/usdMtlx/testenv/testUsdMtlxFileFormat.testenv/open_pbr_ketchup.mtlx @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pxr/usdImaging/usdImaging/testenv/testUsdImagingStageSceneIndexContents/baseline/basic.txt b/pxr/usdImaging/usdImaging/testenv/testUsdImagingStageSceneIndexContents/baseline/basic.txt index febc141946b..d9e76b36e9c 100644 --- a/pxr/usdImaging/usdImaging/testenv/testUsdImagingStageSceneIndexContents/baseline/basic.txt +++ b/pxr/usdImaging/usdImaging/testenv/testUsdImagingStageSceneIndexContents/baseline/basic.txt @@ -149,6 +149,8 @@ def [material] [] + [config] + {} [interfaceMappings] [nodes] [MyPrimvar]