Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
TSL: Add CDLNode #29510
TSL: Add CDLNode #29510
Changes from 1 commit
cfe2889
399097a
ee126f2
200a0c2
d90bdd5
331939a
aa0ad97
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed offline, this should be implemented in log space, and then converted back to linear.
See https://www.mdpi.com/2313-433X/3/4/40 where is says:
This can be corrected later if you want.
EDITED for clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some doubts about this rule (see introduction to https://blender.stackexchange.com/a/55239/43930), but, all usage I have in mind for future PRs would indeed be within a log space. That said — I don't think we can put the conversion inside of CDLNode, as the particular choice of log space may vary, and further color correction operations may follow in the same log space. If we're implementing looks for AgX we'd likely use AgX Log (Kraken), and for ACES Filmic we'd perhaps use ACEScc. #29450 may eventually need to be extended to handle the common log spaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was basing my comment on Filament's implementation and the assumption that log space was the correct space. I am not sure if the particular choice of log space is important for our purposes.
Since we have a node-based system -- and not a fixed pipeline -- I would convert to log and back inside the CDLNode so the calculation is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CDL spec and the ACES document above disagree about this; the former is very clear that application in linear spaces is allowed, so long as you're consistent in communicating the color space expected for any particular set of CDL coefficients.
The ACES pipeline can of course be more opinionated about what to allow, as can we... But I don't think we can embed a particular color space transform into the operation and still call it a CDL, it will be impossible to compare results with other software, and that's the real point of using a CDL.
If we are offering an artist-friendly color grading API like Filament’s ColorGrading.cpp (perhaps we should!), then embedding the log conversion would be entirely appropriate. The CDL would be a single step, in log space, within that process. But the CDL is a mathematical operation, low-level and not particularly artist-friendly, and it must be possible to compose different pipelines around it... which I feel that an internal log conversion will block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, I would argue the color space should be added as a parameter, and the algorithm modified to honor it.
That parameter would include the current working color space, in which case no color space transform is applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm afraid I don't see how this can work. Other common color operators (like contrast) may receive comparable benefit from using a log space, and I think it will be impractical (for performance, numerical precision, and creative intent) to enforce a color space conversion within low-level operators.
Note that the CDL is not itself a "Look" (or LMT as in the ACES literature), a CDL might be just a component of a look. Or one CDL might be applied before tone mapping, and another after. For that reason, we also cannot require that the input to a CDL must be in the global working color space.
To your points — if we wanted to say that a Look should always be done in a log space, I'm aware of no issues with that statement, and I have no plans to do otherwise!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct. Both linear and log space are allowed.
Just so I understand your point, are you planning to add a log-conversion Node of some sort, so users who prefer to apply the CDL in log space can do so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, certainly! Or maybe log conversion could be supported by THREE.ColorManagement and the existing ColorSpaceNode directly... but I'm nervous about getting that right, and inclined to start with 1-2 dedicated log space nodes instead.
I am also hoping to find a simpler higher-level abstraction so that most users do not need to interact with the CDL node directly, but I am not sure, yet, what that will mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I see we are not quite sure where this is headed... So I think this is OK, and we'll see what happens! :-)
An example would be awesome. 🙏