Linear to Log for Film Emulation in Darktable - Are 1D LUTs possible?

FYI I am aware that doing the whole baking trip in Resolve is a huge hassle, I’d rather not do it myself… hence my feature request for either a 1D LUT module or for built-in lin-to-log LUTs in Darktable… (the dream being fully OCIO compliant like Krita, Blender, Nuke, etc… but reading some comments from the devs leads me to believe that’s not going to happen soon lol).

I don’t really know to be honest, I presume you’re right and it’s clamped, but is the whole design purpose of Log gammas not to fit as much information as possible within the bounds of 0-1 values? If so, and the look LUTs are designed to work on a Log input I don’t see it as a major issue.

I edited all these Play RAWs with my double LUT technique (the Log conversion is always the same, the look LUT varies here and there) and for my tastes I don’t feel as though I’m losing anything in the highlights:

Some of them could afford to have slightly stronger blacks, but my tastes were obviously slightly different at the time and it’s easy fix if you wanted to.

Yes you are right, the whole purpose of a LOG format is to cram a lot of dynamic range into 0->1 values.

You are also right that a lot of ‘Look’ LUTs are designed to use LOG input values. That is the whole problem since values in Darktable are not LOG (which is a good thing… we want to edit linear values).

This is why we need an intermediate step (a shaper LUT) to convert from lin to log. In my method I use the ‘unbreak’ module as the shaper LUT to ‘squeeze’ our linear values into a weirdo-log format.

You suggest to use a 3D LUT from LutCALC instead to convert from lin to AlexaV3LogC.

This could work, except I suspect that linear values (which commonly range between 0->20) are being clamped 0->1 by the LUT3D module on input before the lin-to-log conversion, destroying any detail in the highlights above 1.0.

That’s why you have to rolloff the highlights by hand. AlexaV3LogC should be able to store highlights up to linear 55.08 (8 stops above .18 mid gray) into a 0-1 range… even the most overexposed shot shouldn’t need any massaging to fit in there.

That’s also why you’ll never be able to have really bright highlights in your final image (unless you manually massage the log values going into the Look LUT) because the top 5 stops that the LookLUT expects have been clamped off.

Even if the LUT3D module didn’t clamp input values, it is not very practical to do lin to log with a 3D LUT… the LUT would need to be gigantic to accomodate the huge input range of lin values. That’s why 1D shaper LUTs exist.

Feel free to share your lin to logC LUT, I’d love to give it a spin.

I consider any workflow that clamps values above 1 before tonemapping to be a major issue… of course if you’re happy with your workflow, please carry on… the images you shared are lovely of course.

1 Like

I guess this is the crux of it, but I don’t see why you wouldn’t want to do this? In fact I don’t think I’ve ever delivered anything in Resolve without touching at least one of the Lift, Gamma, Gain controls, or contrast and pivot, or a curve adjustment from behind some sort of look LUT - typically a PFE.

The forum won’t let me upload my lut but you could generate your own with LUTCalc. I can’t remember if I deviated from the default range options, but I just set it up like this:

lutsetup

Thanks for the input @Xavier_Bourque and @black_daveth, I follow this thread with great interest. Fact remains that I’m generally able to squeeze a better look out of my A7S III video (shooting S-Log3 with a technical LUT and good creative LUT applied) than what I can get from raw still image sensor data in darktable. I can’t help to wonder if the methods hinted in this thread could be a way to replicate the look I get shooting video. Would love to be able to use the Ultimate Colorist
Toolkit or VisionColor LUTs as intended.

If I’m not mistaken you can zip it and upload as .zip.

Rec202012-bit_Rec2020-LogC_Rec2020.zip (646.8 KB)

quite right.

If you share a video still, a RAW file, and the creative LUT you’ve used I can have a go at matching them and walk you through it if I’m successful with it.

1 Like

Thanks, that’s very generous! It won’t happen for a week or so. Perhaps I’ll give it a go next weekend.

I’m very interested in your module setup in darktable with this:

Care to explain step-by-step or screenshot?

sure.

  1. Open your image and adjust the exposure to something that seems reasonable.
  2. Load the Linear to LogC LUT I uploaded*.
  3. Check the waveform for any highlight clipping, if you’ve got some flat tops use the tone equaliser module to bring them back. I can elborate on this if you need.
  4. Create a new LUT module and load your creative LUT *if your creative LUTs are designed for Slog2 or 3 you’ll probably want to make your own LUT rather than using the Arri log curve in mine.
  5. Move the colour balance RGB module between the two LUT modules and adjust the image to your liking. I’m usually using every slider one time or another except for hue shift and global offset.
  6. Optionally carry out further refinements with more colour balance RGB modules, experiment with before and after the two LUT modules as well. Colour zones is another one of my favourite modules too.
  7. Profiled denoise, contrast equaliser, and send it. Especially if I’m exporting downscaled images for the web I’ll add a tiny amount of extra sharpening and grain using G’MIC from inside GIMP.
1 Like

Awesome, thanks! I’ll give it a try and get back if I have any trouble.

“linear Rec2020 RGB” for the ”Linear to LogC LUT” and “gamma Rec709 RGB” for the creative one?

Yes for the former, but I’ll actually often use sRGB or AdobeRGB for the creative LUT, rec709 tends to lift and crush the blacks a bit much for my liking.

What would be the equivalent values for sigmoid?

I don’t think you can, as sigmoid uses a fixed formula for that additional curve which is not a simple polynomial. Filmic does some fitting of a polynomial function, which can degrade to an identity transform x \mapsto x (which is what you want in the ideal case, though x \mapsto \alpha x works also, but changes the global contrast).

1 Like

Thanks!