diff --git a/lib/mayaHydra/hydraExtensions/adapters/materialNetworkConverter.cpp b/lib/mayaHydra/hydraExtensions/adapters/materialNetworkConverter.cpp index 6cce4f4a0a..fcad6cf217 100644 --- a/lib/mayaHydra/hydraExtensions/adapters/materialNetworkConverter.cpp +++ b/lib/mayaHydra/hydraExtensions/adapters/materialNetworkConverter.cpp @@ -395,6 +395,63 @@ class MayaHydraUvAttrConverter : public MayaHydraMaterialAttrConverter const VtValue _value; }; // namespace +class MayaHydraMixedColorMaterialAttrConverter : public MayaHydraComputedMaterialAttrConverter +{ +public: + MayaHydraMixedColorMaterialAttrConverter( + const TfToken& remappedBaseColorName, + const TfToken& remappedBaseWeightName, + const TfToken& remappedCoatColorName, + const TfToken& remappedCoatWeightName) + : _remappedBaseColorName(remappedBaseColorName) + , _remappedBaseWeightName(remappedBaseWeightName) + , _remappedCoatColorName(remappedCoatColorName) + , _remappedCoatWeightName(remappedCoatWeightName) + { + } + + SdfValueTypeName GetType() override { return SdfValueTypeNames->Vector3f; } + + VtValue GetValue( + MFnDependencyNode& node, + const TfToken& paramName, + const SdfValueTypeName& type, + const VtValue* fallback = nullptr, + MPlugArray* outPlug = nullptr) override + { + VtValue baseColor = MayaHydraMaterialNetworkConverter::ConvertMayaAttrToScaledValue( + node, _remappedBaseColorName.GetText(), _remappedBaseWeightName.GetText(), SdfValueTypeNames->Vector3f, fallback, outPlug); + + // Mix baseColor with coat coatColor + // Check coatColor section in + // https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/bxdf/translation/standard_surface_to_usd.mtlx + if (baseColor.IsHolding()) { + VtValue coatWeight = MayaHydraMaterialNetworkConverter::ConvertMayaAttrToValue( + node, _remappedCoatWeightName.GetText(), SdfValueTypeNames->Float, fallback, outPlug); + if (coatWeight.IsHolding()) { + float coatWeightFloat = coatWeight.UncheckedGet(); + if (coatWeightFloat != 0.0f) { + VtValue coatColor = MayaHydraMaterialNetworkConverter::ConvertMayaAttrToValue( + node, _remappedCoatColorName.GetText(), SdfValueTypeNames->Vector3f, fallback, outPlug); + if (coatColor.IsHolding()) { + GfVec3f baseColorVec3f = baseColor.UncheckedGet(); + GfVec3f coatColorVec3f = coatColor.UncheckedGet(); + GfVec3f coatAttenuationVec3f = GfLerp(coatWeightFloat, GfVec3f(1.0f, 1.0f, 1.0f), coatColorVec3f); + return VtValue(GfCompMult(baseColorVec3f, coatAttenuationVec3f)); + } + } + } + } + + return baseColor; + } + + protected: + const TfToken& _remappedBaseColorName; + const TfToken& _remappedBaseWeightName; + const TfToken& _remappedCoatColorName; + const TfToken& _remappedCoatWeightName; +}; class MayaHydraOpenPBREmissionColorMaterialAttrConverter : public MayaHydraComputedMaterialAttrConverter { @@ -423,8 +480,66 @@ class MayaHydraOpenPBREmissionColorMaterialAttrConverter : public MayaHydraCompu emissionWeightFloat = emissionLuminance.UncheckedGet() / 1000.f; // Map Luminance(0.0-1000.0) to Weight(0-1.0) } - return VtValue(emissionColorVec3f * emissionWeightFloat); + emissionColorVec3f *= emissionWeightFloat; + + // Mix emissionColor with coat coatColor + // Check coatColor section in + // https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/bxdf/translation/standard_surface_to_usd.mtlx + VtValue coatWeight = MayaHydraMaterialNetworkConverter::ConvertMayaAttrToValue( + node, "coatWeight", SdfValueTypeNames->Float, fallback, outPlug); + if (coatWeight.IsHolding()) { + float coatWeightFloat = coatWeight.UncheckedGet(); + if (coatWeightFloat != 0.0f) { + VtValue coatColor = MayaHydraMaterialNetworkConverter::ConvertMayaAttrToValue( + node, "coatColor", SdfValueTypeNames->Vector3f, fallback, outPlug); + if (coatColor.IsHolding()) { + GfVec3f coatColorVec3f = coatColor.UncheckedGet(); + GfVec3f coatAttenuationVec3f = GfLerp(coatWeightFloat, GfVec3f(1.0f, 1.0f, 1.0f), coatColorVec3f); + return VtValue(GfCompMult(emissionColorVec3f, coatAttenuationVec3f)); + } + } + } + + return VtValue(emissionColorVec3f); + } +}; + +class MayaHydraClearCoatMaterialAttrConverter + : public MayaHydraComputedMaterialAttrConverter +{ +public: + MayaHydraClearCoatMaterialAttrConverter( + const TfToken& remappedCoatColorName, + const TfToken& remappedCoatWeightName) + : _remappedCoatColorName(remappedCoatColorName) + , _remappedCoatWeightName(remappedCoatWeightName) + { + } + + SdfValueTypeName GetType() override { return SdfValueTypeNames->Float; } + + VtValue GetValue( + MFnDependencyNode& node, + const TfToken& paramName, + const SdfValueTypeName& type, + const VtValue* fallback = nullptr, + MPlugArray* outPlug = nullptr) override + { + VtValue coatColor = MayaHydraMaterialNetworkConverter::ConvertMayaAttrToScaledValue( + node, _remappedCoatColorName.GetText(), _remappedCoatWeightName.GetText(), SdfValueTypeNames->Vector3f, fallback, outPlug); + if (coatColor.IsHolding()) { + GfVec3f coatColorVec3f = coatColor.UncheckedGet(); + // Check the clearcoat section in + // https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/bxdf/translation/standard_surface_to_usd.mtlx + float clearCoatFolat = (coatColorVec3f[0] + coatColorVec3f[1] + coatColorVec3f[2]) / 3.0f; + return VtValue(clearCoatFolat); + } + return VtValue(0.0f); } + +protected: + const TfToken& _remappedCoatColorName; + const TfToken& _remappedCoatWeightName; }; class MayaHydraCosinePowerMaterialAttrConverter : public MayaHydraComputedMaterialAttrConverter @@ -638,14 +753,16 @@ void MayaHydraMaterialNetworkConverter::initialize() auto uvConverter = std::make_shared(); // Standard surface: - auto baseColorConverter = std::make_shared( + auto baseColorConverter = std::make_shared( MayaHydraAdapterTokens->baseColor, MayaHydraAdapterTokens->base, - SdfValueTypeNames->Vector3f); - auto emissionColorConverter = std::make_shared( + MayaHydraAdapterTokens->coatColor, + MayaHydraAdapterTokens->coat); + auto emissionColorConverter = std::make_shared( MayaHydraAdapterTokens->emissionColor, MayaHydraAdapterTokens->emission, - SdfValueTypeNames->Vector3f); + MayaHydraAdapterTokens->coatColor, + MayaHydraAdapterTokens->coat); auto specularColorConverter = std::make_shared( MayaHydraAdapterTokens->specularColor, MayaHydraAdapterTokens->specular, @@ -656,17 +773,18 @@ void MayaHydraMaterialNetworkConverter::initialize() MayaHydraAdapterTokens->specularRoughness, SdfValueTypeNames->Float); auto metallicConverter = std::make_shared( MayaHydraAdapterTokens->metalness, SdfValueTypeNames->Float); - auto coatConverter = std::make_shared( - MayaHydraAdapterTokens->coat, SdfValueTypeNames->Float); + auto clearCoatConverter = std::make_shared( + MayaHydraAdapterTokens->coatColor, MayaHydraAdapterTokens->coat); auto coatRoughnessConverter = std::make_shared( MayaHydraAdapterTokens->coatRoughness, SdfValueTypeNames->Float); auto transmissionToOpacity = std::make_shared(); // OpenPBR surface: - auto openPBRBaseColorConverter = std::make_shared( + auto openPBRBaseColorConverter = std::make_shared( MayaHydraAdapterTokens->baseColor, MayaHydraAdapterTokens->baseWeight, - SdfValueTypeNames->Vector3f); + MayaHydraAdapterTokens->coatColor, + MayaHydraAdapterTokens->coatWeight); auto openPBREmissionColorConverter = std::make_shared(); auto openPBRSpecularColorConverter = std::make_shared( @@ -680,8 +798,8 @@ void MayaHydraMaterialNetworkConverter::initialize() MayaHydraAdapterTokens->specularRoughness, SdfValueTypeNames->Float); auto openPBRMetallicConverter = std::make_shared( MayaHydraAdapterTokens->baseMetalness, SdfValueTypeNames->Float); - auto openPBRCoatConverter = std::make_shared( - MayaHydraAdapterTokens->coatWeight, SdfValueTypeNames->Float); + auto openPBRClearCoatConverter = std::make_shared( + MayaHydraAdapterTokens->coatColor, MayaHydraAdapterTokens->coatWeight); auto openPBRCoatRoughnessConverter = std::make_shared( MayaHydraAdapterTokens->coatRoughness, SdfValueTypeNames->Float); auto openPBRTransmissionToOpacity @@ -754,7 +872,7 @@ void MayaHydraMaterialNetworkConverter::initialize() { MayaHydraAdapterTokens->specularColor, specularColorConverter }, { MayaHydraAdapterTokens->ior, specularIORConverter }, { MayaHydraAdapterTokens->roughness, specularRoughnessConverter }, - { MayaHydraAdapterTokens->clearcoat, coatConverter }, + { MayaHydraAdapterTokens->clearcoat, clearCoatConverter }, { MayaHydraAdapterTokens->clearcoatRoughness, coatRoughnessConverter }, { MayaHydraAdapterTokens->opacity, transmissionToOpacity }, { MayaHydraAdapterTokens->metallic, metallicConverter }, @@ -769,7 +887,7 @@ void MayaHydraMaterialNetworkConverter::initialize() { MayaHydraAdapterTokens->specularColor, openPBRSpecularColorConverter }, { MayaHydraAdapterTokens->ior, openPBRSpecularIORConverter }, { MayaHydraAdapterTokens->roughness, openPBRSpecularRoughnessConverter }, - { MayaHydraAdapterTokens->clearcoat, openPBRCoatConverter }, + { MayaHydraAdapterTokens->clearcoat, openPBRClearCoatConverter }, { MayaHydraAdapterTokens->clearcoatRoughness, openPBRCoatRoughnessConverter }, { MayaHydraAdapterTokens->opacity, openPBRTransmissionToOpacity }, { MayaHydraAdapterTokens->metallic, openPBRMetallicConverter }, diff --git a/lib/mayaHydra/hydraExtensions/adapters/tokens.h b/lib/mayaHydra/hydraExtensions/adapters/tokens.h index 8a6d3af9b9..6c44df08db 100644 --- a/lib/mayaHydra/hydraExtensions/adapters/tokens.h +++ b/lib/mayaHydra/hydraExtensions/adapters/tokens.h @@ -56,6 +56,7 @@ PXR_NAMESPACE_OPEN_SCOPE (specularIOR) \ (specularRoughness) \ (coat) \ + (coatColor) \ (coatWeight) \ (coatRoughness) \ (transmission) \ diff --git a/test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/coatColor.png b/test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/coatColor.png new file mode 100644 index 0000000000..1cc94727be Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/coatColor.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/coatWeight.png b/test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/coatWeight.png new file mode 100644 index 0000000000..0cc7ac0e7a Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/coatWeight.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/baseColor.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/baseColor.png new file mode 100644 index 0000000000..c1fb43b216 Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/baseColor.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/baseWeight.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/baseWeight.png new file mode 100644 index 0000000000..7aea2525fb Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/baseWeight.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/coatColor.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/coatColor.png new file mode 100644 index 0000000000..1cc94727be Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/coatColor.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/coatWeight.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/coatWeight.png new file mode 100644 index 0000000000..d54ffdecb2 Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/coatWeight.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/default.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/default.png index 8492531a91..1f31d88325 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/default.png and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/default.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/default_noTexture.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/default_noTexture.png new file mode 100644 index 0000000000..b659a998a7 Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/default_noTexture.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/diffuseRoughness.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/diffuseRoughness.png deleted file mode 100644 index 8492531a91..0000000000 Binary files a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/diffuseRoughness.png and /dev/null differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/emission.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/emission.png deleted file mode 100644 index 6282ed2997..0000000000 Binary files a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/emission.png and /dev/null differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/emissionColor.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/emissionColor.png new file mode 100644 index 0000000000..cfa470c77e Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/emissionColor.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/emissionWeight.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/emissionWeight.png new file mode 100644 index 0000000000..779b007c73 Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/emissionWeight.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/geometryOpacity.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/geometryOpacity.png new file mode 100644 index 0000000000..88cefeae8d Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/geometryOpacity.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/metalness.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/metalness.png index a3328901e3..f1a18a7131 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/metalness.png and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/metalness.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularColor.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularColor.png new file mode 100644 index 0000000000..badfe6b6fd Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularColor.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularIOR.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularIOR.png index be97bd0328..45aeae9bd9 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularIOR.png and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularIOR.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularRoughness.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularRoughness.png index a3328901e3..45aeae9bd9 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularRoughness.png and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularRoughness.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularWeight.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularWeight.png new file mode 100644 index 0000000000..b38808044e Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/specularWeight.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/transmission.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/transmission.png deleted file mode 100644 index 2b10c0b83d..0000000000 Binary files a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/transmission.png and /dev/null differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/transmissionWeight.png b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/transmissionWeight.png new file mode 100644 index 0000000000..189c9e4f84 Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/StandardSurfaceTest/transmissionWeight.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testOpenPBRSurface.py b/test/lib/mayaUsd/render/mayaToHydra/testOpenPBRSurface.py index c58e7d59bf..6d98d56694 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testOpenPBRSurface.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testOpenPBRSurface.py @@ -90,9 +90,19 @@ def test_OpenPBRSurface(self): cmds.setAttr("openPBRSurface1.transmissionWeight", 0.5) cmds.refresh() self.assertSnapshotClose("transmissionWeight" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + + #Verify Opacity cmds.setAttr("openPBRSurface1.geometryOpacity", 0.2) cmds.refresh() self.assertSnapshotClose("geometryOpacity" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) - + + #Verify Coat + cmds.setAttr("openPBRSurface1.coatWeight", 0.9) + cmds.refresh() + self.assertSnapshotClose("coatWeight" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + cmds.setAttr("openPBRSurface1.coatColor", 0.0,0.0,0.0, type = 'double3') + cmds.refresh() + self.assertSnapshotClose("coatColor" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + if __name__ == '__main__': fixturesUtils.runTests(globals()) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testStandardSurface.py b/test/lib/mayaUsd/render/mayaToHydra/testStandardSurface.py index ff3a526097..420df56ba2 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testStandardSurface.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testStandardSurface.py @@ -18,13 +18,19 @@ import fixturesUtils import mtohUtils import mayaUtils +import platform class TestStandardSurface(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ IMAGE_DIFF_FAIL_THRESHOLD = 0.01 - IMAGE_DIFF_FAIL_PERCENT = 0.2 + @property + def IMAGE_DIFF_FAIL_PERCENT(self): + # Use a larger tolerance for transparency on OSX + if platform.system() == "Darwin": + return 2 + return 0.2 #Test the translation from maya standard surface with a maya native plane to usd preview surface. def test_StandardSurface(self): @@ -40,35 +46,63 @@ def test_StandardSurface(self): cmds.refresh() self.assertSnapshotClose("default" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) - #Verify Diffuse Roughness - cmds.setAttr("standardSurface1.diffuseRoughness", 0.5) + #Disconnect the texture + cmds.disconnectAttr("file1.outColor", "standardSurface1.baseColor") cmds.refresh() - self.assertSnapshotClose("diffuseRoughness" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + self.assertSnapshotClose("default_noTexture" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + + #Verify Base + cmds.setAttr("standardSurface1.baseColor", 0.5,0.0,0.0, type = 'double3') + cmds.refresh() + self.assertSnapshotClose("baseColor" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + cmds.setAttr("standardSurface1.base", 0.5) + cmds.refresh() + self.assertSnapshotClose("baseWeight" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) #Verify Metalness cmds.setAttr("standardSurface1.metalness", 0.5) cmds.refresh() self.assertSnapshotClose("metalness" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) - #Verify Specular Roughness - cmds.setAttr("standardSurface1.specularRoughness", 0.5) + #Verify Specular + cmds.setAttr("standardSurface1.specularColor", 0.0,0.0,0.5, type = 'double3') + cmds.refresh() + self.assertSnapshotClose("specularColor" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + cmds.setAttr("standardSurface1.specular", 0.2) + cmds.refresh() + self.assertSnapshotClose("specularWeight" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + cmds.setAttr("standardSurface1.specularRoughness", 0.7) cmds.refresh() self.assertSnapshotClose("specularRoughness" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) - - #Verify Specular IOR cmds.setAttr("standardSurface1.specularIOR", 0.5) cmds.refresh() self.assertSnapshotClose("specularIOR" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + #Verify Emission + cmds.setAttr("standardSurface1.emission", 0.5) + cmds.refresh() + self.assertSnapshotClose("emissionWeight" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + cmds.setAttr("standardSurface1.emissionColor", 0.0,0.5,0.0, type = 'double3') + cmds.refresh() + self.assertSnapshotClose("emissionColor" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + #Verify Transmission cmds.setAttr("standardSurface1.transmission", 0.5) cmds.refresh() - self.assertSnapshotClose("transmission" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + self.assertSnapshotClose("transmissionWeight" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + + #Verify Opacity + cmds.setAttr("standardSurface1.opacity", 0.2,0.2,0.2, type = 'double3') + cmds.refresh() + self.assertSnapshotClose("geometryOpacity" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) - #Verify Emission - cmds.setAttr("standardSurface1.emission", 0.5) + #Verify Coat + cmds.setAttr("standardSurface1.coat", 0.9) + cmds.refresh() + self.assertSnapshotClose("coatWeight" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + cmds.setAttr("standardSurface1.coatColor", 0.0,0.0,0.0, type = 'double3') cmds.refresh() - self.assertSnapshotClose("emission" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + self.assertSnapshotClose("coatColor" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) if __name__ == '__main__': fixturesUtils.runTests(globals())