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-805 - add test for look through camera&lights #73

Merged
merged 3 commits into from
Feb 15, 2024
Merged
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
1 change: 1 addition & 0 deletions test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ set(INTERACTIVE_TEST_SCRIPT_FILES
testMayaLights.py
testUSDLights.py
testArnoldLights.py
testLookThrough.py
testStandardSurface.py
testFlowViewportAPI.py
testStageVariants.py
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.
67 changes: 67 additions & 0 deletions test/lib/mayaUsd/render/mayaToHydra/testLookThrough.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#
# Copyright 2024 Autodesk, Inc. All rights reserved.
#
# 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 mayaUtils
import platform

class TestLookThrough(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose
# MayaHydraBaseTestCase.setUpClass requirement.
_file = __file__

@property
def imageDiffFailThreshold(self):
return 0.01

@property
def imageDiffFailPercent(self):
# HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds
# for that platform specifically for now, so we can still catch issues on other platforms.
if platform.system() == "Darwin":
return 3
return 0.2

#Test look through camera and maya lights (spot & area).
def test_LookThrough(self):
# Load a maya scene with a maya native cubic
testFile = mayaUtils.openTestScene(
"testLookThrough",
"testLookThrough.ma")
cmds.refresh()

#Verify Default display
panel = mayaUtils.activeModelPanel()
self.assertSnapshotClose("default" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent)

#Verify look through camera
cmds.lookThru( panel, 'persp1' )
cmds.refresh()
self.assertSnapshotClose("lookThroughCamera" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent)

#Verify look through spot Light
cmds.lookThru( panel, 'spotLight1' )
cmds.refresh()
self.assertSnapshotClose("lookThroughSpotLight" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent)

#Verify look through area light, use a small far clip to clip the scene
cmds.lookThru( panel, 'areaLight1', nc=0.0, fc=7.5 )
cmds.refresh()
self.assertSnapshotClose("lookThroughAreaLight" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent)

if __name__ == '__main__':
fixturesUtils.runTests(globals())
262 changes: 262 additions & 0 deletions test/testSamples/testLookThrough/testLookThrough.ma

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions test/testSamples/testStandardSurface/testStandardSurface.ma
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//Last modified: Mon, Feb 05, 2024 09:30:35 AM
//Codeset: 1252
requires maya "2025ff02";
requires -nodeType "mayaUsdLayerManager" -dataType "pxrUsdStageData" "mayaUsdPlugin" "0.27.0";
currentUnit -l centimeter -a degree -t film;
fileInfo "application" "maya";
fileInfo "product" "Maya 2025";
Expand Down Expand Up @@ -112,9 +111,6 @@ createNode file -n "file1";
setAttr ".cs" -type "string" "sRGB";
createNode place2dTexture -n "place2dTexture1";
rename -uid "6616C90D-4B36-08C7-8666-33BB13D15663";
createNode mayaUsdLayerManager -n "mayaUsdLayerManager1";
rename -uid "61CE7C31-4E04-09B7-BFEA-F291A58D7E4C";
setAttr ".sst" -type "string" "";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes required? Not sure why they're here, doesn't look like they're used

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This's just for clearing out mayausd stuff, this might cause loading of mayausd, which is not necessary for this case.

createNode script -n "uiConfigurationScriptNode";
rename -uid "8E0C2C18-4263-5451-E98E-C6B108D65C44";
setAttr ".b" -type "string" (
Expand Down
Loading