Skip to content

Commit

Permalink
[testusdview] Extend OCIO test to validate color management
Browse files Browse the repository at this point in the history
- Rename testUsdviewOCIO to testUsdviewColorManagement and extend test to validate all color management options (disabled, sRGB and OCIO).
- Set env var during test run.
- Add test to CMake.

See PixarAnimationStudios#1491

(Internal change: 2193575)
  • Loading branch information
rajabala authored and lkerley committed Jan 7, 2022
1 parent d385a7e commit 0f8b3c9
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 26 deletions.
6 changes: 6 additions & 0 deletions pxr/usdImaging/bin/testusdview/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -440,4 +440,10 @@ if (NOT PXR_HEADLESS_TEST_MODE)
EXPECTED_RETURN_CODE 0
)

pxr_register_test(testUsdviewColorManagement
PYTHON
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/testusdview --testScript testUsdviewColorManagement.py test.usda"
EXPECTED_RETURN_CODE 0
)

endif()
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
@@ -1,8 +1,5 @@
ocio_profile_version: 1

# needs to be false to support RV with our file naming conventions
strictparsing: false

roles:
color_picking: Gamma2.2
color_timing: linear
Expand All @@ -17,12 +14,13 @@ roles:

displays:
rec709g22:
- !<View> {name: Gamma 2.2, colorspace: Gamma2.2}
- !<View> {name: Gamma 2.2, colorspace: Gamma2.2}
- !<View> {name: Linear, colorspace: linear}

# by default all displays are active
# When active_displays and active_views sections aren't defined (commented
# below), all displays are active (queryable) with the first display and first
# view being used by default.
# active_displays: [rec709g22]

# by default all views are active
# active_views: [Gamma2.2]

colorspaces:
Expand All @@ -49,18 +47,6 @@ colorspaces:
allocationvars: [0, 1]
to_reference: !<ExponentTransform> {value: [2.2, 2.2, 2.2, 1]}

- !<ColorSpace>
name: lgf
family: log
equalitygroup: ""
bitdepth: 32f
description: |
lgf : conversion from film log
isdata: false
allocation: uniform
allocationvars: [-0.25, 1.5]
to_reference: !<FileTransform> {src: lgf.spi1d, interpolation: linear}

- !<ColorSpace>
name: raw_data
family: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,24 @@
# language governing permissions and limitations under the Apache License.
#

def _modifySettings(appController):
import os
cwd = os.getcwd()
os.environ["OCIO"] = cwd + "/test.ocio"
appController._dataModel.viewSettings.colorCorrectionMode = "openColorIO"
# The OCIO env var is set to the test.ocio config in the test directory before
# it is run.

from pxr.Usdviewq.common import ColorCorrectionModes

def _useOCIO(appController):
appController._dataModel.viewSettings.colorCorrectionMode = ColorCorrectionModes.OPENCOLORIO
appController._dataModel.viewSettings.showHUD = False
# The first view ("Gamma 2.2" will be the default view)
appController._takeShot("colorCorrectionOCIO_g22.png")

def _useFallback(appController):
appController._dataModel.viewSettings.colorCorrectionMode = ColorCorrectionModes.SRGB
appController._takeShot("colorCorrectionSRGB.png")

def _disableColorCorrection(appController):
appController._dataModel.viewSettings.colorCorrectionMode = ColorCorrectionModes.DISABLED
appController._takeShot("colorCorrectionDisabled.png")

# Set the background color and refresh the view.
def _setBackgroundColorAction(appController, action):
Expand All @@ -39,9 +51,10 @@ def _setBackgroundColorAction(appController, action):
# Test with a dark grey background color.
def _testGreyDarkBackground(appController):
_setBackgroundColorAction(appController, appController._ui.actionGrey_Dark)
appController._takeShot("ocio_grey_dark.png")

# Test OpenColorIO in UsdView
def testUsdviewInputFunction(appController):
_modifySettings(appController)
_testGreyDarkBackground(appController)
_useOCIO(appController)
_useFallback(appController)
_disableColorCorrection(appController)

0 comments on commit 0f8b3c9

Please sign in to comment.