LUT documentation (to create from another program)

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

davidanderson

  • Posts: 221
  • Joined: Fri Jun 26, 2015 9:26 pm

LUT documentation (to create from another program)

PostWed Sep 30, 2015 12:52 am

I am hiring a programmer to write me a utility that takes some input files, creates a colour model and it currently outputs the adjusted image.
I'd prefer it to output a LUT that I could use with Resolve, can someone point me to technical documentation re the LUT formats that I could pass onto our programmers?
Offline

Peter Chamberlain

Blackmagic Design

  • Posts: 13944
  • Joined: Wed Aug 22, 2012 7:08 am

Re: LUT documentation (to create from another program)

PostWed Sep 30, 2015 1:04 am

Resolve LUT Info

3D Format (.cube)
The LUT file needs to have an extension of .cube
While described as a 3D LUT format the .cube file could contain ...
○ 3D LUT data (only)
○ 1D LUT data (only)
○ Both a 3D LUT and a 1D 'shaper' LUT.

Irrespective of what data a .cube file contains (1D, 3D or both), it is always displayed by Resolve in the
3D LUT section.

Lines beginning with # are considered comments. All comment lines need to be placed before the
header lines.

3D LUT data (only)
There is a header of 2 lines:
LUT_3D_SIZE N (where N is the number of points along each axis of the LUT.)
LUT_3D_INPUT_RANGE MIN MAX (where MIN is the minimum input value expected to be
passed through the 3D LUT. Like wise for MAX.)

Followed by this are NxNxN rows of RGB values between 0.0 and 1.0. Each row has 3 floating point
numbers separated by a space (space delimited). The data is ordered as red major (red fastest)

Top few lines of a sample .cube 3D LUT file which would contain 33x33x33 rows of 3D LUT data and
expects input in the range 0.0 1.0:

LUT_3D_SIZE 33
LUT_3D_INPUT_RANGE 0.0 1.0
0.000000 0.000000 0.000000
0.047059 0.000000 0.000000
0.101961 0.000000 0.000000
0.156863 0.000000 0.000000
0.207843 0.000000 0.000000
0.262745 0.000000 0.000000
0.321569 0.000000 0.000000
0.376471 0.000000 0.000000
0.427451 0.000000 0.000000
0.482353 0.000000 0.000000
0.537255 0.000000 0.000000
0.592157 0.000000 0.000000


1D LUT data (only)

The 1D LUT data requires a header with the following two fields
LUT_1D_SIZE N (where N is the number of points in each channel of the 1D LUT)
LUT_1D_INPUT_RANGE MIN MAX (where MIN is the minimum input value expected to be
passed through the 1D LUT. Like wise for MAX.)

This is followed by N data lines with 3 floating point values per line with a space separating them (first is
R, second is G, third is B)

Top few lines of a sample .cube file containing 1D LUT data only. It contains 4096 rows of 1D LUT
data and expects input in the range 0.0 1.0:

LUT_1D_SIZE 4096
LUT_1D_INPUT_RANGE 0.0 1.0
0.000000 0.000000 0.000000
0.047059 0.047059 0.047059
0.101961 0.101961 0.101961
0.156863 0.156863 0.156863
0.207843 0.207843 0.207843
0.262745 0.262745 0.262745
0.321569 0.321569 0.321569
0.376471 0.376471 0.376471
0.427451 0.427451 0.427451
0.482353 0.482353 0.482353
0.537255 0.537255 0.537255
0.592157 0.592157 0.592157


1D 'shaper' LUT and 3D LUT data

When a .cube file contains both 1D and 3D LUT data the 1D LUT data is treated as a 'shaper' LUT
and is applied first with the output from the 1D 'shaper' LUT section then being fed into the 3D LUT
section.

A .cube file containing a 1D 'shaper' LUT and 3D LUT data requires a header with the following fields
LUT_1D_SIZE N1D (where N1D is the number of points in each channel of the 1D 'shaper' LUT)
LUT_1D_INPUT_RANGE MIN1D MAX1D (where MIN1D is the minimum input value expected
to be passed through the 'shaper' 1D LUT. Like wise for MAX1D.)
LUT_3D_SIZE N3D (where N3D is the number of points along each axis of the LUT.)
LUT_3D_INPUT_RANGE MIN3D MAX 3D (where MIN3D is the minimum input value expected to be passed through the 3D LUT. Like wise for MAX3D.)

This is followed the 1D 'shaper' data: N1D data lines with 3 floating point values per line with a space
separating them (first is R, second is G, third is B).
Followed by the 3D data: N3DxN3DxN3D rows of RGB values between 0.0 and 1.0. Each row has
3 floating point numbers separated by a space (space delimited). The data is ordered as red major (red
fastest).

Below is an example of a sample .cube file containing 1D 'shaper' LUT and 3D LUT data. It contains 6
rows of 1D LUT data with input in the range 0.0 1.0 and 3x3x3 (27) rows of 3D LUT data with input
in the range 0.0 1.0

# Sample 3D cube file containing 1D shaper LUT and 3D LUT.
# 1. The size and range of both the LUTs should be specified first.
# 2. LUT_*D_INPUT_RANGE is an optional field.
# 3. The 1D shaper LUT below inverts the signal
# 4. The 3D LUT which follows inverts the signal again
LUT_1D_SIZE 6
LUT_1D_INPUT_RANGE 0.0 1.0
LUT_3D_SIZE 3
LUT_3D_INPUT_RANGE 0.0 1.0
1.0 1.0 1.0
0.8 0.8 0.8
0.6 0.6 0.6
0.4 0.4 0.4
0.2 0.2 0.2
0.0 0.0 0.0
1.0 1.0 1.0
0.5 1.0 1.0
0.0 1.0 1.0
1.0 0.5 1.0
0.5 0.5 1.0
0.0 0.5 1.0
1.0 0.0 1.0
0.5 0.0 1.0
0.0 0.0 1.0
1.0 1.0 0.5
0.5 1.0 0.5
0.0 1.0 0.5
1.0 0.5 0.5
0.5 0.5 0.5
0.0 0.5 0.5
1.0 0.0 0.5
0.5 0.0 0.5
0.0 0.0 0.5
1.0 1.0 0.0
0.5 1.0 0.0
0.0 1.0 0.0
1.0 0.5 0.0
0.5 0.5 0.0
0.0 0.5 0.0
1.0 0.0 0.0
0.5 0.0 0.0
0.0 0.0 0.0
DaVinci Resolve Product Manager
Offline

davidanderson

  • Posts: 221
  • Joined: Fri Jun 26, 2015 9:26 pm

Re: LUT documentation (to create from another program)

PostWed Sep 30, 2015 1:26 am

Thanks so much!
Offline

Michael_K

  • Posts: 22
  • Joined: Fri Mar 13, 2020 1:12 pm
  • Real Name: Michael Koch

Re: LUT documentation (to create from another program)

PostFri Jun 23, 2023 8:44 am

Does there exist a specification for *.cube files with the keywords LUT_1D_INPUT_RANGE and LUT_3D_INPUT_RANGE ?

I've only found this specification from 2013:
https://web.archive.org/web/20201027210 ... on-1.0.pdf

where the keywords LUT_1D_INPUT_RANGE and LUT_3D_INPUT_RANGE don't exist and in chapter 5.6 the keywords DOMAIN_MIN and DOMAIN_MAX are specified instead.

Do you know which version is newer or older?

Michael

Return to DaVinci Resolve

Who is online

Users browsing this forum: Alexander Benedik, Aymeric_Pihery, bentomlin, Bing [Bot], Drew Gauley, Jim Simon, kjlongtine, MartyMc, Username, xunile and 247 guests