diff --git a/lib/mayaHydra/hydraExtensions/sceneIndex/mayaHydraSceneIndex.cpp b/lib/mayaHydra/hydraExtensions/sceneIndex/mayaHydraSceneIndex.cpp index 0982e08092..093ec38edb 100644 --- a/lib/mayaHydra/hydraExtensions/sceneIndex/mayaHydraSceneIndex.cpp +++ b/lib/mayaHydra/hydraExtensions/sceneIndex/mayaHydraSceneIndex.cpp @@ -687,16 +687,24 @@ VtValue MayaHydraSceneIndex::CreateMayaDefaultMaterial() VtValue MayaHydraSceneIndex::CreateMayaFacesSelectionMaterial() { const GfVec4f faceSelectioncolor = getPreferencesColor(FvpColorPreferencesTokens->faceSelection); - + constexpr float ogsMatchParamMult = 0.3f; HdMaterialNetworkMap networkMap; HdMaterialNetwork network; HdMaterialNode node; node.identifier = UsdImagingTokens->UsdPreviewSurface; node.path = _mayaFacesSelectionMaterialPath; + + // Diffuse node.parameters.insert( - { _tokens->diffuseColor, - VtValue(GfVec3f(faceSelectioncolor[0], faceSelectioncolor[1], faceSelectioncolor[2])) }); - node.parameters.insert({ _tokens->opacity, VtValue(float(0.3f)) }); + { _tokens->diffuseColor, + VtValue(GfVec3f(faceSelectioncolor[0], faceSelectioncolor[1], faceSelectioncolor[2])*ogsMatchParamMult) }); + + // Emissive (component selection highlighting material should be independent of scene lighting) + node.parameters.insert( + { _tokens->emissiveColor, + VtValue(GfVec3f(faceSelectioncolor[0], faceSelectioncolor[1], faceSelectioncolor[2])*ogsMatchParamMult) }); + + node.parameters.insert({ _tokens->opacity, VtValue(ogsMatchParamMult) }); network.nodes.push_back(std::move(node)); networkMap.map.insert({ HdMaterialTerminalTokens->surface, std::move(network) }); networkMap.terminals.push_back(_mayaFacesSelectionMaterialPath); diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/facesSelStorm.png b/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/facesSelStorm.png index e4751c75df..497d68a1d6 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/facesSelStorm.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/facesSelStorm.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/facesSelVP2.png b/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/facesSelVP2.png index e4751c75df..497d68a1d6 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/facesSelVP2.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/facesSelVP2.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/selectionWithLights.png b/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/selectionWithLights.png new file mode 100644 index 0000000000..05f564e87a Binary files /dev/null and b/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/selectionWithLights.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/smoothwireframe.png b/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/smoothwireframe.png index d658bb9e78..803ecfa63e 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/smoothwireframe.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaComponentsPickingTest/smoothwireframe.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaComponentsPicking.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaComponentsPicking.py index 096328b5ee..cbe21e92b0 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaComponentsPicking.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaComponentsPicking.py @@ -52,6 +52,14 @@ def test_MayaFaceComponentsPicking(self): cmds.modelEditor(panel, edit=True, smoothWireframe=True) cmds.refresh() self.assertSnapshotClose("smoothwireframe" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) + + #Add lights + cmds.directionalLight(rotation=(45, 30, 15)) + cmds.modelEditor(panel, edit=True, displayAppearance="smoothShaded") + cmds.modelEditor(panel, edit=True, displayLights="all") + cmds.select( 'pSphere1.f[1:200]', r=True ) + cmds.refresh() + self.assertSnapshotClose("selectionWithLights" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) if __name__ == '__main__': fixturesUtils.runTests(globals())