Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptomatte fixes #5867

Merged
merged 2 commits into from
May 29, 2024
Merged

Conversation

johnhaddon
Copy link
Member

This fixes one of the problems I found while debugging #5866. Only the first commit is necessary to fix that, but I believe the second commit fixes hashing inaccuracies that would be even harder to diagnose (particularly the missing base-class call). The second commit does restructure things a little bit - might be easiest to review just by looking at the final code for hashChannelData() and computeChannelData() side by side, rather than using the diff.

- Remove stray hashing of the current input channel.
- Check cryptomatte channels exists before hashing them.
- Include cryptomatte alpha channel in hash.

This fixes one of the problems noted in GafferHQ#5866.
The second half of the hash function bore little resemblance to the compute, and had at least one bug : the call to the base class was missing. Conforming the two was simplified by restructuring the compute to reduce nesting by using as many early-outs as possible.
@johnhaddon johnhaddon self-assigned this May 24, 2024
johnhaddon added a commit to johnhaddon/gaffer that referenced this pull request May 24, 2024
The EXR standard states that it is only the upper case "R", "G", "B" and "A" that have a predefined interpretation, and that is how we treat channels in GafferImage. But in the last week I've received files from two different sources both using lower-case, so this seems worth fixing up on load.

In the latter case, the file was from Blender and only the Cryptomatte channels were lowercased. To my surprise, that is actually enshrined in the Cryptomatte specification. I can't find a source for _why_, but based on Psyop/Cryptomatte#35 it seems that _maybe_ it's to disable lossy DWA compression when the DCC won't let you control that per-file or per-part? That seems to call into question the entire idea of using RGBA to represent ID and coverage in the first place, which I believe was originally to play well in apps that only recognised RGBA.

In conjunction with GafferHQ#5867, this fixes GafferHQ#5866.
Copy link
Contributor

@murraystevenson murraystevenson left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for tidying that up!

@murraystevenson murraystevenson merged commit 2d1fe7b into GafferHQ:1.4_maintenance May 29, 2024
5 checks passed
@johnhaddon johnhaddon deleted the cryptomatteFix branch August 7, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants