From 9cd4958dde3bd06d5cb274dc68375b2b5528806d Mon Sep 17 00:00:00 2001 From: Ashwin Bhat Date: Wed, 8 Jan 2025 12:38:57 -0800 Subject: [PATCH] Set Target Colorspace on context Setting the colorspace on the context establishes the target color space for shader generation as lin_rec709, while setting the colorspace on the document potentially modifies the source color spaces without intending to. --- pxr/imaging/hdSt/materialXFilter.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pxr/imaging/hdSt/materialXFilter.cpp b/pxr/imaging/hdSt/materialXFilter.cpp index e2bb494d28..41148c4ace 100644 --- a/pxr/imaging/hdSt/materialXFilter.cpp +++ b/pxr/imaging/hdSt/materialXFilter.cpp @@ -224,10 +224,8 @@ HdSt_GenMaterialXShader( cms->loadLibrary(stdLibraries); mxContext.getShaderGenerator().setColorManagementSystem(cms); - // Set the colorspace - // XXX: This is the equivalent of the default source colorSpace, which does - // not yet have a schema and is therefore not yet accessable here - mxDoc->setColorSpace("lin_rec709"); + // Set the target colorspace + mxContext.getOptions().targetColorSpaceOverride = "lin_rec709"; // Add the Direct Light mtlx file to the mxDoc mx::DocumentPtr lightDoc = mx::createDocument();