diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index 2a9b938e25..d5b226d785 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -625,6 +625,23 @@ MStatus MtohRenderOverride::Render( // Set Purpose tags SetRenderPurposeTags(delegateParams); + // Set MSAA as per Maya AntiAliasing settings + if (_isUsingHdSt) + { + // Maya's MSAA toggle settings + bool isMultiSampled = framecontext->getPostEffectEnabled(MHWRender::MFrameContext::kAntiAliasing); + + // Set MSAA on Color Buffer + HdAovDescriptor colorAovDesc = _taskController->GetRenderOutputSettings(HdAovTokens->color); + colorAovDesc.multiSampled = isMultiSampled; + _taskController->SetRenderOutputSettings(HdAovTokens->color, colorAovDesc); + + // Set MSAA of Depth buffer + HdAovDescriptor depthAovDesc = _taskController->GetRenderOutputSettings(HdAovTokens->depth); + depthAovDesc.multiSampled = isMultiSampled; + _taskController->SetRenderOutputSettings(HdAovTokens->depth, depthAovDesc); + } + _taskController->SetFreeCameraMatrices( GetGfMatrixFromMaya( drawContext.getMatrix(MHWRender::MFrameContext::kViewMtx)), diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/coneLayerCustomWireframe.png b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/coneLayerCustomWireframe.png index 962d18ad15..cf66c307cf 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/coneLayerCustomWireframe.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayLayersTest/coneLayerCustomWireframe.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/allLights.png b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/allLights.png index a6c96f3519..40fe25f952 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/allLights.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/allLights.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/defaultMaterial.png b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/defaultMaterial.png index a6c96f3519..40fe25f952 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/defaultMaterial.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/defaultMaterial.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/displayTextures.png b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/displayTextures.png index 9029795f3c..f77f16d112 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/displayTextures.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/displayTextures.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/shadows.png b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/shadows.png index cd909e8b5a..8b27f82396 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/shadows.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/shadows.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/smoothShaded.png b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/smoothShaded.png index 479db2ab34..5d2faeb60e 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/smoothShaded.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/smoothShaded.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/wireframeOnShaded.png b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/wireframeOnShaded.png index 3a161770e0..2f2c97a155 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/wireframeOnShaded.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/wireframeOnShaded.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/xray.png b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/xray.png index fe4abb0e46..40fe25f952 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/xray.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/xray.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/backfaceCulling.png b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/backfaceCulling.png index 5aff008c0f..ef17ced76e 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/backfaceCulling.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/backfaceCulling.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/boundingBox.png b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/boundingBox.png index 6afb3e1850..3708ebb669 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/boundingBox.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/boundingBox.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/default.png b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/default.png index d0b19601fa..ef17ced76e 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/default.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/default.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/flatShaded.png b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/flatShaded.png index 517b1ee00a..38bb5e3889 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/flatShaded.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/flatShaded.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/jointxray.png b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/jointxray.png index 9b8dd6ff25..ef17ced76e 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/jointxray.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/jointxray.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/smoothwireframe.png b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/smoothwireframe.png index ca4b98fe4e..5e70d7af38 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/smoothwireframe.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/smoothwireframe.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/smoothwireframeonshaded.png b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/smoothwireframeonshaded.png index f47773f084..64d145454c 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/smoothwireframeonshaded.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/smoothwireframeonshaded.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/xray.png b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/xray.png index 2fb02cba6a..9bc5e0de84 100644 Binary files a/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/xray.png and b/test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/xray.png differ diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testFlowViewportAPIViewportInformation.py b/test/lib/mayaUsd/render/mayaToHydra/cpp/testFlowViewportAPIViewportInformation.py index 7a7520194d..6f268edd86 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/cpp/testFlowViewportAPIViewportInformation.py +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testFlowViewportAPIViewportInformation.py @@ -27,7 +27,7 @@ class TestFlowViewportAPIViewportInformation(mtohUtils.MayaHydraBaseTestCase): def test_RendererSwitching(self): with PluginLoaded('mayaHydraCppTests'): #Switch to Storm - self.setHdStormRenderer() + #self.setHdStormRenderer() cmds.refresh() cmds.mayaHydraCppTest(f="FlowViewportAPI.viewportInformationWithHydra") #Switch to VP2 diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testFvpViewportInformationMultipleViewports.cpp b/test/lib/mayaUsd/render/mayaToHydra/cpp/testFvpViewportInformationMultipleViewports.cpp index c60f857e80..b3c2905bf8 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/cpp/testFvpViewportInformationMultipleViewports.cpp +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testFvpViewportInformationMultipleViewports.cpp @@ -44,12 +44,13 @@ TEST(FlowViewportAPI, viewportInformationMultipleViewportsInit) //Get all Hydra viewports information Fvp::InformationInterface::ViewportInformationSet allViewportsInformation; informationInterface.GetViewportsInformation(allViewportsInformation); - ASSERT_EQ(allViewportsInformation.size(), (size_t)0);//We should have 0 hydra viewport + ASSERT_EQ(allViewportsInformation.size(), (size_t)1);//We should have 1 hydra viewport init by the tests script //Check initial count for _infoClientTest callbacks ASSERT_EQ(_infoClientTest->GetSceneIndexAdded(), 0); ASSERT_EQ(_infoClientTest->GetSceneIndexRemoved(), 0); - + + //We don't call UnregisterInformationClient on purpose as we want to check if the callbacks are called and will unregister it in the code below } @@ -71,7 +72,7 @@ TEST(FlowViewportAPI, viewportInformationMultipleViewports2Viewports) ASSERT_EQ(info._rendererName, _stormRendererName); } - ASSERT_EQ(_infoClientTest->GetSceneIndexAdded(), 2);//Has been called twice + ASSERT_EQ(_infoClientTest->GetSceneIndexAdded(), 1);//Has been called once ASSERT_EQ(_infoClientTest->GetSceneIndexRemoved(), 0); } @@ -94,7 +95,7 @@ TEST(FlowViewportAPI, viewportInformationMultipleViewports1Viewport) } //Both should have been called once only - ASSERT_EQ(_infoClientTest->GetSceneIndexAdded(), 2); + ASSERT_EQ(_infoClientTest->GetSceneIndexAdded(), 1); ASSERT_EQ(_infoClientTest->GetSceneIndexRemoved(), 1); } @@ -112,7 +113,7 @@ TEST(FlowViewportAPI, viewportInformationMultipleViewports0Viewport) ASSERT_EQ(allViewportsInformation.size(), (size_t)0);//We should not have any hydra viewport ///Both should have been called once only - ASSERT_EQ(_infoClientTest->GetSceneIndexAdded(), 2); + ASSERT_EQ(_infoClientTest->GetSceneIndexAdded(), 1); ASSERT_EQ(_infoClientTest->GetSceneIndexRemoved(), 2); //Unregister our callbacks client diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayLayers.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayLayers.py index d9fa140381..eb16c96bb0 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayLayers.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayLayers.py @@ -49,6 +49,10 @@ def setLayerDisplayType(self, val): def test_MayaDisplayLayers(self): + # set HdStorm as renderer + self.setHdStormRenderer() + + #set up the scene sphere = cmds.sphere( n='sphere1' ) cone = cmds.cone( n='cone1' ) cmds.move( 1, 5, 1 ) diff --git a/test/testUtils/mayaUtils.py b/test/testUtils/mayaUtils.py index 263c00457b..f6e3fd6c25 100644 --- a/test/testUtils/mayaUtils.py +++ b/test/testUtils/mayaUtils.py @@ -39,6 +39,9 @@ mayaSeparator = "|" +HD_STORM = "HdStormRendererPlugin" +HD_STORM_OVERRIDE = "mayaHydraRenderOverride_" + HD_STORM + def loadPlugin(pluginName): """ Load all given plugins created or needed by maya-ufe-plugin @@ -124,9 +127,18 @@ def getMayaSelectionList(): else: return [x for x in cmds.ls(sl=True)] +def setHdStormRenderer(): + activeEditor = cmds.playblast(activeEditor=1) + cmds.modelEditor( + activeEditor, e=1, + rendererOverrideName=HD_STORM_OVERRIDE) + cmds.setAttr("hardwareRenderingGlobals.multiSampleEnable", True) + cmds.refresh(f=1) + def openTestScene(*args): filePath = testUtils.getTestScene(*args) cmds.file(filePath, force=True, open=True) + setHdStormRenderer() def openTopLayerScene(): ''' diff --git a/test/testUtils/mtohUtils.py b/test/testUtils/mtohUtils.py index 79a145fc56..021c82b10a 100644 --- a/test/testUtils/mtohUtils.py +++ b/test/testUtils/mtohUtils.py @@ -53,22 +53,24 @@ class MayaHydraBaseTestCase(unittest.TestCase): def setUpClass(cls): if cls._file is None: raise ValueError("Subclasses of MayaHydraBaseTestCase must " - "define `_file = __file__`") + "define `_file = __file__`") # Set up all tests with their own test directory to write out test-specific coverage information fixturesUtils.setUpClass(cls._file, 'mayaHydra', - initializeStandalone=False) + initializeStandalone=False) def setUp(self): # Maya is not closed/reset between each test of a test suite, # so open a new file before each test to minimize leftovers # from previous tests. cmds.file(new=True, force=True) + self.setHdStormRenderer() def setHdStormRenderer(self): self.activeEditor = cmds.playblast(activeEditor=1) cmds.modelEditor( self.activeEditor, e=1, - rendererOverrideName=HD_STORM_OVERRIDE) + rendererOverrideName=HD_STORM_OVERRIDE) + cmds.setAttr("hardwareRenderingGlobals.multiSampleEnable", True) cmds.refresh(f=1) self.delegateId = cmds.mayaHydra(renderer=HD_STORM, sceneDelegateId="MayaHydraSceneDelegate") @@ -156,7 +158,7 @@ def setUpClass(cls): if not inputDirName.endswith('Test'): inputDirName += 'Test' cls._inputDir = os.path.join(inputPath, inputDirName) - + cls._testDir = os.path.abspath('.') def resolveRefImage(self, refImage, imageVersion):