-
Notifications
You must be signed in to change notification settings - Fork 4
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-927 - Expose complexity settings in globalRenderSettings #106
Changes from 3 commits
9a47a5b
7dc2057
5cf138f
f098e53
38a3a43
97b5c16
57d44cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -622,6 +622,10 @@ MStatus MtohRenderOverride::Render( | |
_mayaHydraSceneIndex->PreFrame(drawContext); | ||
} | ||
|
||
if (_displayStyleSceneIndex) { | ||
vlasovi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
_displayStyleSceneIndex->SetRefineLevel({true, delegateParams.refineLevel}); | ||
} | ||
|
||
HdxRenderTaskParams params; | ||
params.enableLighting = true; | ||
params.enableSceneMaterials = true; | ||
|
@@ -742,7 +746,7 @@ MStatus MtohRenderOverride::Render( | |
if (_mayaHydraSceneIndex) { | ||
_mayaHydraSceneIndex->PostFrame(); | ||
} | ||
|
||
return MStatus::kSuccess; | ||
} | ||
|
||
|
@@ -831,7 +835,7 @@ void MtohRenderOverride::_InitHydraResources(const MHWRender::MDrawContext& draw | |
|
||
_mayaHydraSceneIndex = MayaHydraSceneIndex::New(mhInitData, !_hasDefaultLighting); | ||
TF_VERIFY(_mayaHydraSceneIndex, "Maya Hydra scene index not found, check mayaHydra plugin installation."); | ||
|
||
VtValue fvpSelectionTrackerValue(_fvpSelectionTracker); | ||
_engine.SetTaskContextData(FvpTokens->fvpSelectionState, fvpSelectionTrackerValue); | ||
|
||
|
@@ -884,15 +888,15 @@ void MtohRenderOverride::ClearHydraResources(bool fullReset) | |
_sceneIndexRegistry.reset(); | ||
} | ||
|
||
#ifdef CODE_COVERAGE_WORKAROUND | ||
// Leak the Maya scene index, as its base class HdRetainedSceneIndex | ||
// destructor crashes under Windows clang code coverage build. | ||
#ifdef CODE_COVERAGE_WORKAROUND | ||
// Leak the Maya scene index, as its base class HdRetainedSceneIndex | ||
// destructor crashes under Windows clang code coverage build. | ||
_mayaHydraSceneIndex->RemoveCallbacksAndDeleteAdapters(); | ||
_mayaHydraSceneIndex.Reset(); | ||
#else | ||
#else | ||
_ClearMayaHydraSceneIndex(); | ||
#endif | ||
|
||
#endif | ||
_displayStyleSceneIndex = nullptr; | ||
_selectionSceneIndex.Reset(); | ||
_selection.reset(); | ||
|
||
|
@@ -945,6 +949,10 @@ void MtohRenderOverride::_CreateSceneIndicesChainAfterMergingSceneIndex() | |
_sceneIndexRegistry.reset(new MayaHydraSceneIndexRegistry(_renderIndexProxy)); | ||
} | ||
|
||
// Add display style scene index | ||
vlasovi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
_lastFilteringSceneIndexBeforeCustomFiltering = _displayStyleSceneIndex = | ||
HdsiLegacyDisplayStyleOverrideSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe worth checking the perf impact (switch to Hydra/First Frame) after introducing this SceneIndex. We expect, by default, with refine level is 0, the overhead should be trivial There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lilike-adsk With refine level set to 0, I haven't noticed any performance impact of this change. The FPS maybe degraded with refine levels more than 0, but this is expected. |
||
|
||
auto wfSi = TfDynamic_cast<Fvp::WireframeSelectionHighlightSceneIndexRefPtr>(Fvp::WireframeSelectionHighlightSceneIndex::New(_lastFilteringSceneIndexBeforeCustomFiltering, _selection)); | ||
wfSi->SetDisplayName("Flow Viewport Wireframe Selection Highlight Scene Index"); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Copyright 2024 Autodesk | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
import maya.cmds as cmds | ||
|
||
import fixturesUtils | ||
import mtohUtils | ||
import unittest | ||
import testUtils | ||
|
||
class TestRefinement(mtohUtils.MtohTestCase): | ||
_file = __file__ | ||
|
||
IMAGEDIFF_FAIL_THRESHOLD = 0.01 | ||
IMAGEDIFF_FAIL_PERCENT = 0.1 | ||
|
||
def verifySnapshot(self, imageName): | ||
cmds.refresh() | ||
self.assertSnapshotClose(imageName, | ||
self.IMAGEDIFF_FAIL_THRESHOLD, | ||
self.IMAGEDIFF_FAIL_PERCENT) | ||
|
||
@unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") | ||
def test_usdPrim(self): | ||
import usdUtils | ||
usdScenePath = testUtils.getTestScene('testStagePayloadsReferences', 'cube.usda') | ||
usdUtils.createStageFromFile(usdScenePath) | ||
|
||
self.setBasicCam(1) | ||
self.setHdStormRenderer() | ||
cmds.mayaHydra(createRenderGlobals=1) | ||
|
||
cmds.setAttr("defaultRenderGlobals.mtohRefinementLevel", 0) | ||
cmds.mayaHydra(updateRenderGlobals="mtohRefinementLevel") | ||
self.verifySnapshot("usd_cube_refined_0.png") | ||
|
||
cmds.setAttr("defaultRenderGlobals.mtohRefinementLevel", 2) | ||
cmds.mayaHydra(updateRenderGlobals="mtohRefinementLevel") | ||
self.verifySnapshot("usd_cube_refined_2.png") | ||
|
||
cmds.setAttr("defaultRenderGlobals.mtohRefinementLevel", 4) | ||
cmds.mayaHydra(updateRenderGlobals="mtohRefinementLevel") | ||
self.verifySnapshot("usd_cube_refined_4.png") | ||
|
||
#restore the default | ||
cmds.setAttr("defaultRenderGlobals.mtohRefinementLevel", 0) | ||
cmds.mayaHydra(updateRenderGlobals="mtohRefinementLevel") | ||
|
||
if __name__ == '__main__': | ||
fixturesUtils.runTests(globals()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the refineLevel which is adapters, MayaHydraAdapter::GetDisplayStyle().refineLevel > 0)
Is what you do replaces this ? Or is this something else ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the added one is the global refine level, while the one in DisplayStyle is per-primitive, but it's not enabled yet due to MRenderItem was already refined. HdsiLegacyDisplayStyleOverrideSceneIndex can be used to override the per-primitive one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand MayaHydraAdapter is used only for Maya native prims. The new scene index is supposed to be used only for USD prims. I will add "addExcludedSceneRoot" to it in my next commit to exclude Maya prims