Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HYDRA-738 : Add support for Maya's AntiAliasing toggle to affect Hydra's MSAA toggle #90

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions lib/mayaHydra/mayaPlugin/renderOverride.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayLayers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
12 changes: 12 additions & 0 deletions test/testUtils/mayaUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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():
'''
Expand Down
10 changes: 6 additions & 4 deletions test/testUtils/mtohUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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):
Expand Down