MrLixm / AgXc

Fork of Troy.S AgX, a display rendering transform available via OCIO and more
92 stars 8 forks source link

[nuke] AgXc DRT investigation #28

Open MrLixm opened 8 months ago

MrLixm commented 8 months ago

This will act as a logbook for the further investigation of the AgXc DRT for Nuke that was release in v0.10.0.

I will note anything that I found that could help improve it.

MrLixm commented 8 months ago

print contrast

Test around the "print contrast" options. The initial release put it after the second tonescale but before it is linearized.

testA

put the Print contrast sigmoid parabolic after the linearisation.

image

test B

sandwich the sigmoid parabolic between Log Shapers (still after linearization)

MrLixm commented 8 months ago

outset

The outset is currently behind a linearize sandwich and applied after the first tonescale. The amount is driven by a simple lerp (NodeWrapper node) between the input of the outset and its output.

testA

remove the linearized sandwich

testB

Test the effect of the second Inset (part for the second tonescale section).

For that we disable the second log shaper + tonescale.

The second inset has default value of inset:0.4, r: 0.06, g: 0, b: 0.06 while first inset has values of inset: 0.4, r: 0.125, g: 0, b: 0.15

nuke screenshot without second inset

^ without second inset

nuke screenshot with second inset

^ with second inset, same global inset values as first inset (r,g,b inset are different)

nuke screenshot with no outset

^ removed the outset and the second inset

nuke screenshot with no outset

^ changed the second inset so its value perfectly match the first inset. It's a perfect match as if we remove outset+second inset.

MrLixm commented 8 months ago

luminance compensation

Something I wanted to tackle since the beginning. I'm not even sure those words are accurate to describe the issue but again keeping in lack of better. This is of course in reference to the Eary and other Blender-Artist folks implementation: https://github.com/EaryChow/AgX_LUT_Gen/blob/main/luminance_compenstation_bt2020.py

While experimenting with grading under the AgXcDRT I stumbled on a cool side effect of operating on chroma in isolation of luma. Let me showcase it :

nuke screenshot, no compensation

^ default AgXcDRT with no compensation

nuke screenshot, with compensation

^ default AgXcDRT with compensation applied

The effect is most visible on the green dragon cg render.

The algorithm consist in :

The algorithm is as follows :

  1. find luma using R-G-B weights computed from colorspace primaries and whitepoint
  2. extract chroma by dividing luma
  3. apply +1 offset on chroma
  4. apply 0.5 power on chroma
  5. apply 0.25 gain on luma to compensate for chroma change
  6. multiplying back chroma with luma to recombine image
  7. lerping 6. with luma calculated in 1. to only apply changes on higher values

Again no idea why it works, but it does.

issues

The observed issue with the current implementation are that it fix high values, but not low values as you can see on the green dragon. This can be addressed by removing the lerp with luma, but which create highly natural "brilliant" colors, especially the blue.