diff --git a/pxr/usdImaging/bin/usdrecord/usdrecord.py b/pxr/usdImaging/bin/usdrecord/usdrecord.py index 8bb63989cc..f45f7839ee 100644 --- a/pxr/usdImaging/bin/usdrecord/usdrecord.py +++ b/pxr/usdImaging/bin/usdrecord/usdrecord.py @@ -146,6 +146,13 @@ def main() -> int: 'Width of the output image. The height will be computed from this ' 'value and the camera\'s aspect ratio (default=%(default)s)')) + parser.add_argument('--enableDomeLightVisibility', action='store_true', + dest='domeLightVisibility', + help=('Show the dome light background in the rendered output. ' + 'If this option is not included and there is a dome light in ' + 'the stage, the IBL from it will be used for lighting but not ' + 'drawn into the background.')) + parser.add_argument('--renderPassPrimPath', '-rp', action='store', type=str, dest='rpPrimPath', help=( @@ -259,6 +266,7 @@ def main() -> int: frameRecorder.SetCameraLightEnabled(args.cameraLightEnabled) frameRecorder.SetColorCorrectionMode(args.colorCorrectionMode) frameRecorder.SetIncludedPurposes(purposes) + frameRecorder.SetDomeLightVisibility(args.domeLightVisibility) _Msg('Camera: %s' % usdCamera.GetPath().pathString) _Msg('Renderer plugin: %s' % frameRecorder.GetCurrentRendererId()) diff --git a/pxr/usdImaging/usdAppUtils/frameRecorder.cpp b/pxr/usdImaging/usdAppUtils/frameRecorder.cpp index 993b9e5588..4fd4b5b8c6 100644 --- a/pxr/usdImaging/usdAppUtils/frameRecorder.cpp +++ b/pxr/usdImaging/usdAppUtils/frameRecorder.cpp @@ -41,7 +41,8 @@ UsdAppUtilsFrameRecorder::UsdAppUtilsFrameRecorder( _complexity(1.0f), _colorCorrectionMode(HdxColorCorrectionTokens->disabled), _purposes({UsdGeomTokens->default_, UsdGeomTokens->proxy}), - _cameraLightEnabled(true) + _cameraLightEnabled(true), + _domeLightsVisible(false) { // Disable presentation to avoid the need to create an OpenGL context when // using other graphics APIs such as Metal and Vulkan. @@ -97,6 +98,12 @@ UsdAppUtilsFrameRecorder::SetCameraLightEnabled(bool cameraLightEnabled) _cameraLightEnabled = cameraLightEnabled; } +void +UsdAppUtilsFrameRecorder::SetDomeLightVisibility(bool domeLightsVisible) +{ + _domeLightsVisible = domeLightsVisible; +} + void UsdAppUtilsFrameRecorder::SetIncludedPurposes(const TfTokenVector& purposes) { @@ -419,6 +426,10 @@ UsdAppUtilsFrameRecorder::Record( _imagingEngine.SetLightingState(lights, material, SCENE_AMBIENT); + _imagingEngine.SetRendererSetting( + HdRenderSettingsTokens->domeLightCameraVisibility, + VtValue(_domeLightsVisible)); + UsdImagingGLRenderParams renderParams; renderParams.frame = timeCode; renderParams.complexity = _complexity; diff --git a/pxr/usdImaging/usdAppUtils/frameRecorder.h b/pxr/usdImaging/usdAppUtils/frameRecorder.h index 791ad31b15..d5dd1bc0d5 100644 --- a/pxr/usdImaging/usdAppUtils/frameRecorder.h +++ b/pxr/usdImaging/usdAppUtils/frameRecorder.h @@ -45,11 +45,6 @@ class UsdAppUtilsFrameRecorder /// plugin will be chosen depending on the value of \p gpuEnabled. /// The \p gpuEnabled argument determines if the UsdAppUtilsFrameRecorder /// instance will allow Hydra to use the GPU to produce images. - /// The \p renderSettingsPrimPath argument is used to set the active - /// render settings prim path in Hydra. - /// The \p defaultLights argument determines if the - /// UsdAppUtilsFrameRecorder will add a default set of lights, - /// in addition to any present in the scene. USDAPPUTILS_API UsdAppUtilsFrameRecorder( const TfToken& rendererPluginId = TfToken(), @@ -122,6 +117,13 @@ class UsdAppUtilsFrameRecorder USDAPPUTILS_API void SetCameraLightEnabled(bool cameraLightEnabled); + /// Sets the camera visibility of dome lights. + /// + /// When on, dome light textures will be drawn to the background as if + /// mapped onto a sphere infinitely far away. + USDAPPUTILS_API + void SetDomeLightVisibility(bool domeLightsVisible); + /// Sets the UsdGeomImageable purposes to be used for rendering /// /// We will __always__ include "default" purpose, and by default, @@ -163,6 +165,7 @@ class UsdAppUtilsFrameRecorder SdfPath _renderPassPrimPath; SdfPath _renderSettingsPrimPath; bool _cameraLightEnabled; + bool _domeLightsVisible; }; diff --git a/pxr/usdImaging/usdAppUtils/wrapFrameRecorder.cpp b/pxr/usdImaging/usdAppUtils/wrapFrameRecorder.cpp index 8774b53f52..7d859c89f1 100644 --- a/pxr/usdImaging/usdAppUtils/wrapFrameRecorder.cpp +++ b/pxr/usdImaging/usdAppUtils/wrapFrameRecorder.cpp @@ -36,6 +36,7 @@ wrapFrameRecorder() .def("SetRendererPlugin", &This::SetRendererPlugin) .def("SetImageWidth", &This::SetImageWidth) .def("SetCameraLightEnabled", &This::SetCameraLightEnabled) + .def("SetDomeLightVisibility", &This::SetDomeLightVisibility) .def("SetComplexity", &This::SetComplexity) .def("SetColorCorrectionMode", &This::SetColorCorrectionMode) .def("SetIncludedPurposes", &This::SetIncludedPurposes,