LMTs Part 3: How do they work and how are they made? (continued...)

lmt
look-transforms
Tags: #<Tag:0x00007f3c5db55248> #<Tag:0x00007f3c5db55090>

(Scott Dyer) #1

In Part 2, the process for creating empirical LMTs was described. However, empirical LMTs can have limitations that analytic LMTs enable users to avoid.

This post will continue to step through the creation of a LMTs at increasing levels of complexity.

[Transforms used in this article are again provided as CTL code at the end of the article.]

Analytic LMTs

Analytic LMTs are defined mathematically and are expressed as a set of ordered mathematical operations on color component values. The operations can range from simple and concise to as complex as necessary to create a desired look.

The most basic operations are primary color corrections that affect all pixels equally, such as contrast, saturation, and exposure. More complex LMTs might introduce secondary corrections such as hue, saturation, luminance, or a combination of these. Because LMTs are image-wide adjustments, spatial corrections (e.g. windows, garbage mattes, etc.) as well as temporally-variable adjustments (e.g. keyframing) are not currently supported.

A simple example of an analytic LMT is one that applies an ASC CDL as a primary grade. A more complex analytic LMT might adjust saturation based on luminance, qualified by certain hue angles. Even more complex LMTs might chain multiple primary and secondary corrections together. There is no limit to the order of or number of operations allowed in an LMT. There is also no limit imposed on the number of individual LMTs that may be sequenced. It is acceptable (and equivalent) to sequence multiple simple LMTs or to sequence multiple operations within a single LMT file.

Analytic LMT – Example 1 (lower contrast & saturation)

This first example is a simple analytic LMT that adjusts image contrast and saturation. Such a transform could be useful to those who prefer to begin color grading with a lower contrast and saturation than the default in ACES-based projects.

Design approach

Instinctually, it seems the transform should convert ACES2065-1 to ACEScct, apply some ASC CDL-like adjustments, and convert ACEScct back to ACES2065-1 (Figure 4).

Figure 4. The design approach for an analytic LMT that adjusts image contrast. ACES2065-1 is first transformed to ACEScct. ASC CDL adjustments are applied in ACEScct as the “working space.” Finally, ACEScct is transformed back to ACES2065-1.

The math for each of these individual steps is well defined so writing the code for the full Look Transform is a simple matter of sequencing the individual functions together in order. The ASC CDL parameters can be tuned to the desired level of adjustment.

An alternate design approach

ACEScc or ACEScct are appropriate color spaces in which to apply ASC CDL operations. However, note that there are no rules in the creation or application of LMTs that restrict image contrast adjustment via other operators or in other color spaces. For example, mathematical relationships between linear and log spaces imply that one could instead apply a gamma adjustment in linear space (Figure 5) and attain a similar adjustment to the image contrast as having done a contrast adjustment in a log space.

Figure 5. An alternate design approach for an analytic LMT that adjusts image contrast. ACES2065-1 is treated as the “working space” and, because the data is linear, a simple gamma is used to affect contrast.

To demonstrate, an alternate LMT (1c) is also provided that adjusts contrast in linear space using a gamma. This “gamma adjust” transform takes as input both a gamma value and a “pivot” point, which is the linear value around which the slope of that the line will pivot in log-log space. In other words, the pivot defines an anchor point which is “pinned” and will not be modified. The default for this pivot point is set to mid-gray, or an ACES value of 0.18.

Tuning

To assist with visualizing the effect of the LMT parameters and tuning the settings, one can utilize a neutral gradient spanning a range of stops centered around mid-gray (ACES=0.18). By plotting exposure level vs. output code value for an ACES Output Transform with no LMT and then overplotting code values from the tuned LMTs + the Output Transform, the effect of the parameters can be compared against the unmodified transform (Figure 6).

On the graph, equal mid-gray levels are indicated if the curves intersect each other at 0 on the scene exposure (relative to mid-gray) axis. In order to keep mid-gray at the same place in the LMT that applies ASC CDL in ACEScct (1a), the offset and power parameters were used to move mid-gray back near its original output level after the slope parameter had been adjusted to decrease contrast. The second LMT that applies ASC CDL in ACEScct (1b) was adjusted to have a contrast even lower than that of LMT 1a, with offset and power again used to restore mid-gray to its pre-slope-adjusted value.

The saturation of images is already somewhat naturally reduced by a decrease in contrast of the tone scales. However, the saturation levels in both 1a and 1b were explicitly further reduced using the ASC CDL “sat” operator.

Analytic LMT 1c uses the alternate approach of adjusting gamma in linear ACES space. The gamma was set to 0.6, which matches the contrast of LMT 1b closely. Note, however, that the curve continues to extend to 0 and doesn’t flare up as it does when contrast is adjusted in ACEScct.


Figure 6. Comparing the effects of the Analytic LMTs on image contrast using a neutral gradient.

Results

Below you can see the results of the Analytic LMTs on actual images and vector scope plots.


Figure 7. Default ACES Output – Rec. 709 (left) and corresponding vectorscope (right)

Figure 8. LMT 1a + ACES Output – Rec. 709 (left) and corresponding vectorscope (right)

Figure 9. LMT 1b + ACES Output – Rec. 709 (left) and corresponding vectorscope (right)


Figure 10. LMT 1c + ACES Output – Rec. 709 (left) and corresponding vectorscope (right)

Analytic LMT – Example 2

In Example 1, ASC CDL was used to generically lower image contrast and saturation – a simple process. For most who want a less “contrasty” or “poppy” starting point, this is probably sufficient. But what if one wants to exactly match the neutral tone scale rendering of another transform?

For example, imagine a colorist really likes starting with the “LUT X” look because they are very used to the starting contrast and degree of highlight and shadow rolloff. They want to see exactly the same neutral tone scale rendering on their ACES-based project. Using the process discussed earlier, one could create an empirical LMT to exactly match the “LUT X” look. However, it has already been demonstrated that empirical LMTs have limits. But what if the colorist is really just attached to the tone curve contrast and isn’t necessarily tied to the particular rendering of the colors? This is a perfect case to create an LMT where the neutral tonescale is analyzed and matched, while allowing colors to fall where they will.

Design approach

The derivation of a neutral tone scale adjustment required to match the tone curve of “LUT X” is actually quite similar to the procedure used for building empirical LMTs. However, instead of constructing a 3D-LUT, only a 1D-LUT is sought to define the neutral tone scale adjustment that is required such that when ACES2065-1 data is sent through the ACES system tone scale, the net result matches that of LUTX. The appropriate Inverse Output Transform is used to derive the relationship between ACES and ACES’, indicated by the dashed gray box below.

Using an inverse Input Transform, a carefully sampled range of neutral ACES values is converted to the Camera X encoding needed for input to LUT X and then processed through LUT X to get Rec. 709 code values. Those code values are then processed through the Inverse Output Transform for Rec. 709 (combined Inverse Rec. 709 ODT and Inverse RRT), yielding a set of ACES’ values that encapsulate a mapping that will match the neutral tone scale appearance of LUT X through the forward ACES Output Transform. This relationship of input to output, illustrated with a dashed gray box in Figure 11, is derived once and used to populate a 1D-LUT that can drop into an ACES workflow as an LMT to recreate the look of LUT X.


Figure 11. A carefully sampled range of neutral ACES values is transformed to Camera X encoding and then processed through LUT X to get display code values. Those code values are transformed back to ACES’ values using the Inverse Output Transform for that output encoding. The mapping of the original sampled ACES values to the ACES’ values is saved in the form of a 1D-LUT that can subsequently be used in an ACES rendering chain to match the neutral tone scale appearance of LUT X within the context of the ACES System.

Following the procedure in Figure 11 using a ramp of ACES values logarithmically spaced between -6.5 and +6.5 stops around mid-gray (these points correspond to code values of 0 and 1 on output) results in the 1D-LUT relationship depicted in Figure 12.

Figure 12. Plot of original ACES values vs the resulting ACES’ values.

However, this 1D-LUT will have the same issue as empirical LUTs and be limited to the output range of the transforms used to derive it. In this specific example, any ACES values above 16.292 will be limited to 9.378, and any ACES values below 0.00198 will be limited to 0.00743. Those are the minimum and maximum linear ACES values that could possibly result through this LMT – only a 10 stop range!

In order to extend the usable range of this 1D-LUT so that images passed through it are not necessarily clamped to that range, one can extrapolate the LUT in log space. By using linear extrapolation in log-log space, a larger range can be supported by the LUT (Figure 13). Extrapolation should help to assure that values across a much larger range of ACES will return unique values.

Figure 13. Plot of original ACES values vs the resulting ACES’ values, with ends extrapolated linearly in log space.

Results

Below you can see the result of using a 1D-LUT to match a neutral tonescale, without doing anything to specifically adjust colors.


Figure 14. ACES Output Transform (left) vs. LMT-Analytic 2 + ACES Output Transform (right)

Figure 15. LMT-Analytic 2 + ACES Output Transform (left) vs. LUT X (right)

Except for reds/magentas, the match between the two is already much closer. If desired, one could of course add additional processing complexity to the LMT in order to adjust saturation or specific hues. Any additional tweaking is left as an exercise to the reader.

Complex hue-specific processing will be explored in the next post.

Supporting CTL transforms

Below are download links for the CTL transforms used in the examples in this post.

Dependencies:


LMTs Part 4: How do they work and how are they made? (continued...)
Creating a 1D spi1d shaper?
(Rémi Achard) #2

Hi Scott,

Thanks for a great post, as always.

Just wanted to know : how do you recommend to use these CTL transformations in current grading tools ? With the upcoming ocio release is there any chance to have native CTL transformation support and automatic shader conversions for example ? I know it’s relatively easy to convert this by hand (to .dctl or whatever shader language available) but just curious, and I guess baking them to LUT would be kind of sad and loose precision if one has to address all the ACES exposure range.

(I think the Figure 8 is linked to analytic C instead of A)


(Scott Dyer) #3

Yes, good catch! I was just testing to see if anyone was paying attention :wink:
I’ve made the correction.


(Scott Dyer) #4

Good questions. I do touch on implementation briefly in the final part of the series, but the points you make and the questions you are asking are the right ones.

I do agree that it would be nice to have a common implementation that runs in most grading tools. It would be a lot of work if there was a need to translate and maintain versions of complex analytic LUTs across multiple languages.

I personally can’t speak much to what the OCIO update might allow for, since I haven’t been following that announcement and all it entails too closely. Perhaps someone who knows more about OCIO can weigh in?

For simple transforms like these it would be nice to not lose precision by needing to bake them into a LUT. At least for Analytic 1a and 1b, those should be able to be implemented pretty well as .clf LUTs (CLF has an ASC CDL process node). Of course, .clf is also not yet supported by many systems. Not sure what the ideal implementation might be that would avoid a need for maintaining multiple versions of the same LMT in different languages.

I’d be interested to hear thoughts from others.


(Jim Houston) #5

Great explanations Scott.

I just wanted to mention, as Scott shows, that a ASC CDL correction can be an LMT. LMTs are normally
intended for systematic changes to sequences (tracked on the timeline across a set of shots). In at least the current mode, many LMTs would be turned into LUTs with the other components of the ACES Viewing Transform. That is not lightweight though, so it is not intended to replace other ways of using the ASC CDL for shot by shot correction (EDL based numbers for example). In short, some CDLs can be LMTs, but not all CDLs are LMTs.


(Andrew) #6

The ACESlib.LMT_Common library defines Rec709 luma weighting for ASC CDL applied in ACEScct. Is this correct?

Shouldn’t it use AP1 and does linear sat use AP0 weighting?


(Nick Shaw) #7

ASC CDL always uses Rec. 709 luma weightings. It’s in the spec. It is always applied the same way, no matter what the working space. The ACES implementation of ASC CDL varies only in that it does not clamp 0-1.


(Andrew) #8

I know the spec Nick but shouldn’t the weighting, applied as per the above Analytic LMTs, be appropriate to the working colorspace primaries? Using Rec709 weighting in AP1 doesn’t really make any sense without first transforming to Rec709 primaries!? and I don’t see that happening in the LMT Library. Wouldn’t CDL saturation produce a different image in ACES when compared to other systems or am I missing something?


(Nick Shaw) #9

That is the case with pretty much every grading operator (Baselight’s Basegrade is the only obvious exception, and I don’t know how that handles saturation). They all give a different visual result depending on the working space they are applied in. It may not be technically correct (although bear in mind that luma is only a crude approximation of luminance in any case, being a weighted sum of gamma coded values, not linear) but grading is an aesthetic, not a technical, process and what constitutes ‘correct’ is what the colourist and client want the image to look like.


(Jim Houston) #10

Yes, an operation taking the ASC CDL number for sat (only) should apply it to a rec709 space in float and then convert back to ap1/ap0

You can also construct a sat matrix in ap1 where the sat factor is reduced per 709 scaling. The same result. This might need a tutorial. There are also problems with ASC cdl sat you have to be careful with.

Jim