Skip to content

fix: SG-43392: Fix ACES 2 displaying black#1275

Open
tjjackson wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
dreamworksanimation:bugfix/aces2_support
Open

fix: SG-43392: Fix ACES 2 displaying black#1275
tjjackson wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
dreamworksanimation:bugfix/aces2_support

Conversation

@tjjackson
Copy link
Copy Markdown
Contributor

Linked issues

Fixes #1010

Summarize your change.

Added logic to OCIOIPNode to pass LUT parameters to helper functions used by the GLSL shader function.

There is already a function in OCIOIPNode, shaderAddLutAsParameter(), to handle doing this for the shader function itself. I added functionality to to catch and update all cases where a LUT is being used inside of a function called by the shader. This should help future-proof the codebase for future OCIO GLSL changes.

There was also some discussion internal at our studio if it be better to use Slang or a similar library to handle the GLSL editing instead of manually text-parsing/editing, but I wasn't sure if the project wanted to add that as a dependency just for this one operation.

Alternatively, if we want to implement a smaller-scoped fix for the specific issue that was happening with ACES 2, I will put that fix in the comments.

Describe the reason for the change.

It appears that the GLSL shader function generated by OCIO 2.4 with ACES 2 is calling helper functions that in turn reference the LUTs. The OCIO GLSL assumes that these LUTs are global, but OpenRV expects them to be passed as function arguments. Since they are not, the image is displaying black.

Describe what you have tested and on which operating system.

Tested with a CY2025 build using an ACES 2 OCIO config on Rocky Linux 9.7. The results were signed off by our studio's color scientist.

Signed-off-by: TJ Jackson <tj.jackson@dreamworks.com>
@tjjackson
Copy link
Copy Markdown
Contributor Author

            static const string samplerSuffix("Sampler");
            const string baseName = lutSamplerName.substr(0, lutSamplerName.size() - samplerSuffix.size());
            const string helperName = baseName + "_sample";

            inout_glsl = regex_replace(
                inout_glsl,
                regex("\\b(" + helperName + "\\(float\\s+\\w+)\\)"),
                "$1, " + lutSamplerType + " " + lutSamplerName + ")");

            inout_glsl = regex_replace(
                inout_glsl,
                regex("\\b(" + helperName + "\\()([^,)]+)(\\))"),
                "$1$2, " + lutSamplerName + "$3");

Alternate, more hardcoded, but smaller solution for getting ACES 2 that could alternatively be added to shaderAddLutAsParameter

@bernie-laberge bernie-laberge changed the title Fix ACES 2 displaying black fix: SG-43392: Fix ACES 2 displaying black May 19, 2026
@bernie-laberge bernie-laberge added PR: Planned_P1 PR will be review and set soon. Expect 1 to 4 weeks delay. community Contribution from the Open RV Community PR: In Progress PR is being reviewed by code reviewer. and removed PR: Planned_P1 PR will be review and set soon. Expect 1 to 4 weeks delay. labels May 19, 2026
Copy link
Copy Markdown
Contributor

@bernie-laberge bernie-laberge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great as is and is way better than my original primitive implementation !
Thank you @tjjackson !

@bernie-laberge bernie-laberge added PR: In Testing This PR is being built and tested by QA. and removed PR: In Testing This PR is being built and tested by QA. labels May 20, 2026
@bernie-laberge
Copy link
Copy Markdown
Contributor

FYI @tjjackson : I have a build error on our Autodesk jenkins pipeline on both Rocky 8 and Rocky 9 event though it shouldn't happen since we are building with gcc 11 (where std::regex_constants::multiline should be defined)
I'll investigate tomorrow.

/mnt/data/jenkins/linux_rhel9_rv_0/OpenRV/src/lib/ip/OCIONodes/OCIOIPNode.cpp: In function 'std::vector<std::__cxx11::basic_string<char> > IPCore::{anonymous}::functionsMissingLutAsParameter(const string&, const string&)':

/mnt/data/jenkins/linux_rhel9_rv_0/OpenRV/src/lib/ip/OCIONodes/OCIOIPNode.cpp:311:78: error: 'multiline' is not a member of 'std::regex_constants'
  311 |                                                        std::regex_constants::multiline);

@tjjackson
Copy link
Copy Markdown
Contributor Author

I am not sure why it would be getting a build error regarding std::regex_constants::multiline, I didn't get any build issues in Rocky 9.7.

But it did get me thinking about my current implementation, it is only matching against functions that start at col 0. maybe it should be more robust and match against functions whose previous non-whitespace character was either a ';' or '}'. That would get rid of the need for std::regex_constants::multiline and also match against top-level functions that for some reason have whitespace at the start of the line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Contribution from the Open RV Community PR: In Progress PR is being reviewed by code reviewer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ACES 2.0 No Image Output

2 participants