MrLixm / AgXc

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

fix(ocio): handling of negatives values in log transform #13

Closed MrLixm closed 1 year ago

MrLixm commented 1 year ago

Closes #11

Hey, this PR fix the issues with negatives in the AgX Log colorspace. My initial solution was using a "dummy" LUT, doing nothing, but still clamping between 0 and 1. I actually found it was not working in the pre-log section so I removed it in #10 .

I found another solution using an unintentional behaviour in the CDLTransform (documented in the v2 doc), where negatives are clamped when the power is not 1.

So I just slap it pre-log and post-log and goodby negatives. It is still hacky because I had to use a small offset in the power value to the 2 forward/inverse transform are not considered a no-op, and the clamp is still applied. This means there is a small unintended difference in the output data that I don't like to have. But I think we could discard that seeing the benefits it brings.

This works on OCIOv1 and OCIOv2 (behaviour was preserved on v2 for v1 config).

Changes