-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HYDRA-1226 - Support translation of openPBR (#193)
* support translation of openPBR * use emissionLuminance/1000.0f as emissionWeight * remove unused token * add a unit test * update threshold for osx and test scene for 2025.3 * add missing platform lib * set same specularDiffuse for consistent results on 2025 and 2026 * update based on review * update based on review
- Loading branch information
1 parent
d8c2707
commit 9e1ec41
Showing
19 changed files
with
483 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.56 KB
test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/baseWeight.png
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.
Binary file added
BIN
+4.89 KB
test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/default_noTexture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.81 KB
test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/emissionColor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.71 KB
test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/emissionLuminance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.95 KB
test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/geometryOpacity.png
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.
Binary file added
BIN
+12.5 KB
test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/specularColor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.8 KB
test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/specularIOR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.8 KB
test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/specularRoughness.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.19 KB
test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/specularWeight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.01 KB
test/lib/mayaUsd/render/mayaToHydra/OpenPBRSurfaceTest/transmissionWeight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# | ||
# 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 TestOpenPBRSurface(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose | ||
# MayaHydraBaseTestCase.setUpClass requirement. | ||
_file = __file__ | ||
|
||
IMAGE_DIFF_FAIL_THRESHOLD = 0.01 | ||
@property | ||
def IMAGE_DIFF_FAIL_PERCENT(self): | ||
# Use a larger tolerance for transparency on OSX | ||
if platform.system() == "Darwin": | ||
return 2 | ||
return 0.2 | ||
|
||
#Test the translation from maya OpenPBR surface with a maya native plane to usd preview surface. | ||
def test_OpenPBRSurface(self): | ||
# Load a maya scene with a maya native plane, which has autodesk OpenPBR surface as material | ||
testFile = mayaUtils.openTestScene( | ||
"testOpenPBRSurface", | ||
"testOpenPBRSurface.ma") | ||
cmds.refresh() | ||
|
||
#Verify Default display | ||
panel = mayaUtils.activeModelPanel() | ||
cmds.modelEditor(panel, edit=True, displayTextures=True) | ||
cmds.refresh() | ||
self.assertSnapshotClose("default" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
|
||
#Disconnect the texture | ||
cmds.disconnectAttr("file1.outColor", "openPBRSurface1.baseColor") | ||
cmds.refresh() | ||
self.assertSnapshotClose("default_noTexture" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
|
||
#Verify Base | ||
cmds.setAttr("openPBRSurface1.baseColor", 0.5,0.0,0.0, type = 'double3') | ||
cmds.refresh() | ||
self.assertSnapshotClose("baseColor" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
cmds.setAttr("openPBRSurface1.baseWeight", 0.5) | ||
cmds.refresh() | ||
self.assertSnapshotClose("baseWeight" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
|
||
#Verify Metalness | ||
cmds.setAttr("openPBRSurface1.baseMetalness", 0.5) | ||
cmds.refresh() | ||
self.assertSnapshotClose("metalness" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
|
||
#Verify Specular | ||
cmds.setAttr("openPBRSurface1.specularColor", 0.0,0.0,0.5, type = 'double3') | ||
cmds.refresh() | ||
self.assertSnapshotClose("specularColor" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
cmds.setAttr("openPBRSurface1.specularWeight", 0.2) | ||
cmds.refresh() | ||
self.assertSnapshotClose("specularWeight" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
cmds.setAttr("openPBRSurface1.specularRoughness", 0.7) | ||
cmds.refresh() | ||
self.assertSnapshotClose("specularRoughness" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
cmds.setAttr("openPBRSurface1.specularIOR", 0.5) | ||
cmds.refresh() | ||
self.assertSnapshotClose("specularIOR" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
|
||
#Verify Emission | ||
cmds.setAttr("openPBRSurface1.emissionLuminance", 500.0) | ||
cmds.refresh() | ||
self.assertSnapshotClose("emissionLuminance" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
cmds.setAttr("openPBRSurface1.emissionColor", 0.0,0.5,0.0, type = 'double3') | ||
cmds.refresh() | ||
self.assertSnapshotClose("emissionColor" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
|
||
#Verify Transmission | ||
cmds.setAttr("openPBRSurface1.transmissionWeight", 0.5) | ||
cmds.refresh() | ||
self.assertSnapshotClose("transmissionWeight" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
cmds.setAttr("openPBRSurface1.geometryOpacity", 0.2) | ||
cmds.refresh() | ||
self.assertSnapshotClose("geometryOpacity" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) | ||
|
||
if __name__ == '__main__': | ||
fixturesUtils.runTests(globals()) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.