3D LUT module in darktable 2.7 (dev)

A way to apply 3D LUT in dt is introduced with the module lut3d.

image

A 3D lut is a tridimensional table which allows to transform any rgb value into another rgb value.
This transform is very rigid (you cannot tune the effect apart with blending) but it’s a quick way to apply a colour effect (film-emulation) to an image.

3d LUT files

The module accepts cube and haldclut files.
Cube files are used for video editors. They are text files with the cube extension. You can find such files through this link:

Haldclut files are used in G’MIC, RT, photoflow. The are usually coded as a png image. Here are some places to find them:
http://rawtherapee.com/shared/HaldCLUT.zip
http://gmic.eu/color_presets/index.shtml

Caution: before selecting a 3D lut file, you must define the root folder where you have stored the lut files, in preferences / core options / miscellaneous.
image

Note: due to the size of the lut, lut data are not saved with the parameters of the image. Instead the file path (inside the root folder) is saved. Then you need to backup properly the lut files (+ folders) you have used.

Color space

Each 3D lut is built to be applied on a given color space. lut3d lets you select the appropriated one.

Usually cube files are built for REC.709 and haldclut for sRGB.

Note: This works when lut3d module is placed between input color profile and output color profile. Otherwise the selected color profile is ignored, and the lut is applied on the work profile.

Interpolation

The RGB cube defined by the lut file is characterised by its dimensions (ie. the size of the cube). It’s always below 256.
The largest it is, the most accurate is the transform. But it takes also more time to decode the file and consumes more memory.
The smallest it is, the fastest the module is. And here you might see some effect of the interpolation method (to calculate colours which are not exactly on a node of the cube).

There are three interpolation methods available: tetrahedral (the default one), trilinear and pyramid.

Usually haldclut cubes are larger than cube cubes.

17 Likes

WOW. Works fine.

It works really nice!,
Thanks a lot for your time and energy into this.

1 Like

Thank you!
When in the pipeline it shall be enabled? Does it matter?

Thank you for this new module and sharing it. It works great, I have the impression that the B/W conversions with HaldCLUT.png are more subtle than those in the manual. I saw that there is a GitHub to convert HaldCLUT.png to.cube: GitHub - mikeboers/LUT-Convert: Converter of LUTs

It reminds me of the abandoned HaldCLUT branch.

https://freshluts.com/

freshLUTs is the world’s largest collection of free LUTs. You can browse and download any LUT you like. You can also add LUTs to your favorites and keep track of all the LUTs you downloaded. Filmmakers can upload their LUTs here and share it with the world.

3 Likes

Thank you for sharing. I just looked at the size of the.cube I produced. They are much heavier than the HaldCLUT.pgn that I used to generate them.

Yes, that’s exactly where I started from.

Well, depends on what you want to achieve and on the type of lut you use.
I would say (but I’m not expert for this) that for film look usage it should be close to the latest (before colour out). Keep also in mind that lut transform is usually not linear and therefore can break the colour accuracy of your image.

Transforming an haldclut file to cube file is interesting when your application doesn’t read haldclut. Otherwise it seems better to keep the haldclut one (more compact for the same amount of data).
NB: there are 8 bits and 16 bits png haldclut files. 16 bits haldclut are more accurate, but only if they have not been derived from 8 bits ones.

It’s fair to say that working on this was a great opportunity for me to learn about dt, reading the code from other authors, copying it, answering the reviewers’ questions and listening to testers’ guidance. A big thanks to all of them.

3 Likes

I cannot wait to experience this module. Thanks a lot also from my side.

A little OT and newbie question…

Is there an easy way to do this multi-replies? I only see that full quote button…
TNX

Great source !

image

In the gamma category, most of the values are not applicable in dt, especially the log ones.
The log colour profiles are camera manufacturers’ raw profiles. To take advantage of them we would have to make dt able to treat them as a raw profile (before color input module).

EDIT: see log and hdr explanations by Sony https://helpguide.sony.net/di/pp/v1/en/print.pdf

1 Like

You select the piece of text you want to reply to. A Quote overlay does appear just above your selection. Clicking on it adds the quote to your current message.
I hope that answer the question…

2 Likes

It does!
Thank you very much!

Cheers
Axel

BTW, Philippe maybe you could write a text for the darktable blog?

See for example : blog | darktable

1 Like

@phweyland perhaps you could use the G’MIC CLUT compression

1 Like

Impressive! It claims to achieve 99% compression !!.
G’MIC provides already some tools to compress and uncompress the lut files.

The @jpg comment is more text cube file related which is bigger than equivalent png file, by nature.

But the interesting news here it that, with a 99% compression rate, it could turn possible to store the lut (compressed) data along with the image’s dev parameters (instead of keeping only the file name).

For reference https://hal.archives-ouvertes.fr/hal-02066484v3/document

I’d gladly share the decompression code (in C++) for integration into any free software that needs this feature :wink: https://framagit.org/dtschump/libclut

4 Likes

That sounds great !
Is there any convention already defined to distinguish a compressed haldclut from an uncompressed one ? Or is there an automatic way to know that a png haldclut is compressed ?

I don’t have non-compressed HaldCLUTs anymore in G’MIC, so all CLUTs available in G’MIC are compressed this way.

Something to be integrated into your dt 2.8 presentation (as there is for each new module for dt 2.6), is that what you think about ?

Indeed there will be a need for documentation for this module.

But I was also thinking about a blog post to show what could be done with this new module. As an example see this blog post:

This is more a communication to advertise the new features.