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

Wow… merry christmas to me, I got a nice tutorial and demo files for a reply… Thank you for taking the time to prepare such a nice thorough and detailed response. I really appreciate you sharing your experience and knowledge…

4 Likes

Thank you for this! It’s worked great so far for me.

1 Like

Thank you @Xavier_Bourque for sharing your findings and writing a Github feature request! I really hope we’ll see support for 1D LUTs in a future version of darktable.

Until then I’ll probably continue using my lowly Rec. 709 look LUTs after sigmoid. The Resolve hacking looks a bit dizzying for a Premiere user like me.

Would however love to see an example of the output you or @sorelrjphoto get with your workflow!

BTW, the pictures on your portfolio site are quite stunning @sorelrjphoto! “White car surrounded by rolling hills” :trophy:

1 Like

Is actually not hard and the resolve workflow is provided… I managed it so it can’t be that challenging :grin:

1 Like

Since we’re talking proprietary software (Resolve), would Lattice be able to convert a 1D LUT to a 3D one for use in darktable?

Site says it can:

Easily convert between 1D and 3D LUTs

OpenColorIO is the gold standard of open source color management. It includes the utility ociobakelut that can create 1D and 3D LUTs.

However, converting scene linear values that have very very high upper limits usually require true 1D LUTs or some sort of parametric conversion based on a math formula instead of a look up table (the ‘unbreak’ module and sigmoid are examples of this)

3D LUTs by definition dont have enough resolution to convert an image with ‘infinite’ input values.

Using a 1D LUT converted to 3D might work for log-to-log but probably not for lin-to-log.

It may be possible to prepare 3D LUTs that convert weirdo ‘unbreak’ log to more common log formats (ArriLogC, sony sLog3, etc…)

Once you have a few utility LUTs prepared, this would save you the trouble of ‘baking’ every creative LUT you want to try.

Not sure if you would end up with banding or other artifacts though, but worth a try.

-X

I understand that doing things rigorously and accurately is always better (and you’ve done a good job figuring out this workflow), but considering all RAW editing is eventually comes down to mapping linear values to a smaller display range, unless you have some sort of critical colour matching job where your stills have to match the output of your cinema camera (and if you were in this boat you probably can’t afford to have any qualms about using Resolve), I don’t see why you can’t just take your medicine a bit earlier in the pixel pipeline.

I’ve got a linear to LogC 3D LUT I use in darktable sometimes (made on LUTCalc), and if I see that its clipping highlights on the waveform I can just roll them off a bit in the tone equalizer. Doesn’t take much, and you’re basically good to go with any “look” LUT designed for video.

I think the issue is here that the 3D lut module in DT is going to take your LUT and you have to assume it fits with one of the input selections of the module . There are no log inputs. If you have a logC lut that color grades a specific look based on that expected input then the look of your lut will be distorted…

I suspect lots of people throw luts in to DT and don’t know or don’t worry about this because its a trial and error to get something that looks good…

I’m certainly a bit of a kamikaze when it comes to LUTs in darktable, but like I said, in non-critical applications like I’d hazard a guess most of our photographic ones are, i.e. where the only thing that really matters is a pleasing output at the end of the pipe, I haven’t run into any quality issues whatsoever.

If you map the linear gamma to a log one the result should still fit within the bounds of what the LUT module can deal with, and if you need to do some sort of repositioning the colour balance RGB module is more than capable of fine tuning things.

EDIT: its clearly non-precise and I’ll definitely be migrating to Xavier’s method that’s been outlined here, but if you want easier access to the colourful world of LUTs you can definitely bodge it with darktable and LUTCalc if you want to avoid Resolve (and to be fair, its an awful lot of software for simply baking a few LUTs. Can be non-trivial to get going on Linux systems too).

Dave, what range can your 3D LUT accommodate on input without clamping? 0->1 or more? I think (?) the LUT3D module clamps the input 0-1 no matter what.

I agree that above certain linear values (let’s say 25ish, 7 stops above .18 mid point) the point becomes moot… even with a very ‘soft’ look LUT, values above 20 will probably be ‘white’ after the tone map.

However, I would consider values 0->20 to be the ‘healthy’ range you would want your ‘look’ LUT to have access to. I would personally consider a workflow that clamps linear values to 0->1 before the look LUT (forcing you to ‘compress’ your values by eye before feeding them into the 3D LUT) to be less than ideal.

‘Rolling off’ the highlights in a pleasing and photographic way is a big part of the ‘look’ and messing with the values by hand is what this whole workflow is trying to avoid.

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.