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

Well thanks for such a nice descriptive post… This will be fun to try and might even inspire those with the time interest talent or all 3 to think of ways that we could enhance some of these sorts of things in DT. I appreciate you taking the time to share… All the best

I think the easiest way for developers to enable this workflow would be to enable 2 things the LUT3D module:

1- Add standard ‘log’ profiles to the ‘application color space’ menu in the LUT3D module (or let users define custom profiles somehow). This would be the ‘shaper LUT’ that converts from linear/rec2020 to whatever LOG/gamut format is expected by your 3DLUT.

2- Add an ‘output color space’ menu to the LUT3D module so that LUT3D can communicate what colorspace is coming out of itself to the rest of the pixel pipe. This option should not modify pixels in any way… just add metadata on output.

What is the best way to do feature requests for Darktable?

Here’s the ACES sRGB display transform baked into a DT-friendly .cube LUT if you want to try this workflow without jumping through all the hoops in Resolve.

DT_unbreak_rec2020_to_ACES_sRGB_Display.zip (773.1 KB)

2 Likes

GitHub.

There have been a couple of topics pop up about enhancing LUT3d (there might be others these are just the ones I recall)

That looks very interesting. A little over my head at present - I’ll have to do a bit more reading, but thanks for writing it up in full. :slight_smile:

I’ve opened a new feature request on GitHub… reading the comments on these 2 request… I think it might be non-trivial to get this one through. Color management is very tricky to discuss when not everyone is on the same page.

What do they say… you can’t win without a ticket…
:grin:

1 Like

I threw this at a couple of playraw files and it works pretty well. Now the challenge will be to try and make one of those cooked luts :slight_smile:

First off thanks for sharing this with us. I thought I would try to work through this myself to see if I could run the process on a different lut…

For your current framework as presented would something like this be a candidate??

https://freshluts.com/luts/1438

I think I might still need a little hand holding when and if you have the time… please feel free to ignore me as well…

I have fired up Davinci in which I am almost a pure novice. I added the tools that you show in your layout diagram and followed your suggestion to change the settings to match as best I can.

I just have a few questions… ie of the so what next sort of thing. I looked at the overall diagram and there seems to be 3 parts or groups in the toolchain. The four modules in the OCiO/ACES section

image

This bit

And this bit…

If I understand and I don’t but I will take a run at it , the main string of modules across the middle makes the “baked” in LUT and the string of 4 at the end are added in the case where you want to preview the lut on a DT export that is generated with unbreak??

I am not sure exactly the role of the first four tools that are not linked but include the ACEStransform… (EDIT: would it be that you replace the FIleLUT1 and slide down the these four to introduce the lut via an ACES display transform)… Hence why you label it FileLUT1_1… I’ll stop speculating now until I see a comment from someone what actually understands it :slight_smile: )

So I guess basically I am not sure with certainty what goes where. If I have a lut with a similar gamut and color space as the one you used I would guess I can simply plug that in…

I’ll poke around a bit more on my own but any direction on this from yourself or someone proficient in DR would be welcomed…

Thanks in advance…

Yes. You can use any LUT on FreshLUTs in Darktable (as long as you ‘bake’ them in Resolve). Remember that no baking / Resolve would be required if Darktable had proper ‘log’ shapers built-in the to LUT3D module (or if Darktable implemented OCIO). :slight_smile:

These nodes are not connected to anything in the node graph. This means these nodes are not currently in use. FileLUT and OCIOFileTransform are the nodes that you use in Fusion to load and apply a .cube file (i.e. the equivalent of the DT LUT3D module).

Yes. Exactly.

Yes. Exactly. Simply adjust the settings of the FileLUT node to your desired .cube file.

#######

Here is a Fusion comp file already setup. To open it in Resolve, go to File → Import → Fusion Composition

Darktable_LUT_baker_v02.zip (1.4 MB)

(I’ve also included the original LUT from Freshluts and the ‘baked’ LUT ready to use in Darktable).

To bake your own LUTs:
Make sure the Inspector is enabled (top right). Click on any node in the node graph to adjust its settings. Use the ‘1’ and ‘2’ hotkeys to view the output of the selected node in the left/right viewers. The triangles on the nodes are inputs (yellow = main input, blue=mask, green=secondary). The squares are outputs.

Once the .comp file is loaded, you need to adjust a few things (numbers refer to the notes in the Fusion node graph).

03- Adjust the output colorspace/gamma of ColorSpaceTransform1 to whatever your LUT is expecting on input (i.e. sLog3 / sGamut3)

04- Adjust the LUT File path of FileLUT1 to your desired LUT (i.e. C:\some\folder\S-LOG3_to_Rec709_v6.cube)

05- Adjust the input colorspace/gamma of ColorSpaceTransform2 to whatever your LUT is supposed to output (i.e. rec709/rec709)

07- Adjust the Filename of LUTCubeAnalyzer1 to where you want to write your ‘baked’ LUT for Darktable. (i.e. C:\some\folder\myDarktable3DLUT.cube) Click ‘Write File’ to write the cube file to disk.

08- (Optional) if you desire to preview your LUT, replace MediaIn1 with an ‘unbreakLOG’ image exported from Darktable (see notes). Drag and drop your image from a File Explorer to the Media Pool, then drag from the Media Pool to the node graph.

Have fun, good luck!

–X

7 Likes

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.