From 531d1c9fceee7c462efeb39ade9963702e6d16e4 Mon Sep 17 00:00:00 2001 From: Jon Creighton <65668160+jonny-apple@users.noreply.github.com> Date: Wed, 22 Mar 2023 18:45:59 +0000 Subject: [PATCH] Dome light visibility flag in usdRecord --- pxr/usdImaging/bin/usdrecord/usdrecord.py | 10 ++++++++++ pxr/usdImaging/usdAppUtils/frameRecorder.cpp | 7 +++++++ pxr/usdImaging/usdAppUtils/frameRecorder.h | 5 +++++ pxr/usdImaging/usdAppUtils/wrapFrameRecorder.cpp | 1 + 4 files changed, 23 insertions(+) diff --git a/pxr/usdImaging/bin/usdrecord/usdrecord.py b/pxr/usdImaging/bin/usdrecord/usdrecord.py index e3ff537af5..4291c7ed8c 100644 --- a/pxr/usdImaging/bin/usdrecord/usdrecord.py +++ b/pxr/usdImaging/bin/usdrecord/usdrecord.py @@ -163,6 +163,12 @@ def main(): '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('--domeLightCameraVisibility', action='store_true', + 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 but the background ' + 'will be transparent.')) + parser.add_argument('--renderPassPrimPath', '-rp', action='store', type=str, dest='rpPrimPath', help=( @@ -276,6 +282,10 @@ def main(): _Msg('Camera: %s' % usdCamera.GetPath().pathString) _Msg('Renderer plugin: %s' % frameRecorder.GetCurrentRendererId()) + frameRecorder.SetRendererSetting( + "domeLightCameraVisibility", + args.domeLightCameraVisibility) + for timeCode in args.frames: _Msg('Recording time code: %s' % timeCode) outputImagePath = args.outputImagePath.format(frame=timeCode.GetValue()) diff --git a/pxr/usdImaging/usdAppUtils/frameRecorder.cpp b/pxr/usdImaging/usdAppUtils/frameRecorder.cpp index 9474f4bedb..9496ff21e6 100644 --- a/pxr/usdImaging/usdAppUtils/frameRecorder.cpp +++ b/pxr/usdImaging/usdAppUtils/frameRecorder.cpp @@ -124,6 +124,13 @@ UsdAppUtilsFrameRecorder::SetIncludedPurposes(const TfTokenVector& purposes) } } +void +UsdAppUtilsFrameRecorder::SetRendererSetting(TfToken const& id, + VtValue const& value) +{ + _imagingEngine.SetRendererSetting(id, value); +} + static GfCamera _ComputeCameraToFrameStage(const UsdStagePtr& stage, UsdTimeCode timeCode, const TfTokenVector& includedPurposes) diff --git a/pxr/usdImaging/usdAppUtils/frameRecorder.h b/pxr/usdImaging/usdAppUtils/frameRecorder.h index f9e08453eb..44d9995d8f 100644 --- a/pxr/usdImaging/usdAppUtils/frameRecorder.h +++ b/pxr/usdImaging/usdAppUtils/frameRecorder.h @@ -158,6 +158,11 @@ class UsdAppUtilsFrameRecorder const UsdTimeCode timeCode, const std::string& outputImagePath); + /// Sets a renderer setting's value. + USDAPPUTILS_API + void SetRendererSetting(TfToken const& id, + VtValue const& value); + private: UsdImagingGLEngine _imagingEngine; size_t _imageWidth; diff --git a/pxr/usdImaging/usdAppUtils/wrapFrameRecorder.cpp b/pxr/usdImaging/usdAppUtils/wrapFrameRecorder.cpp index 7e854ea9ac..cecf72a070 100644 --- a/pxr/usdImaging/usdAppUtils/wrapFrameRecorder.cpp +++ b/pxr/usdImaging/usdAppUtils/wrapFrameRecorder.cpp @@ -61,5 +61,6 @@ wrapFrameRecorder() arg("usdCamera"), arg("timeCode"), arg("outputImagePath"))) + .def("SetRendererSetting", &This::SetRendererSetting) ; }