UM:Appendix 3D Lut File Format V3

From DigitalVision
Revision as of 15:18, 23 February 2017 by Alastair (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Darrow-up.png     Previous Next

3D LUT File Format

LUT format v3 extends support to High Dynamic Range (HDR) images (e.g. OpenEXR) and allows the transformation of extended range inputs. This means LUT data values can exist outside the range 0.0 to 1.0.

 

dv_note

Example LUT files are distributed in the folder :

 

C:\PRODUCT\VERSION\root\cms\

 

In addition, example C programs are included to generate sample LUT files. These are found in the Example Code folder alongside some sample program outputs.

 

v2 format code example :
Example Code\Lut3D.cpp</br>
v3 format code example :
Example Code\Lut3Dv3.cpp</br>

 

The Nucoda 3D LUT file format is ASCII text with a .cms file extension.

 

The file is composed of :

 

1D x 3 floating point LUT and a
3D x 3 floating point LUT

 

dv_note

The LUT file can contain a 1D LUT, a 3D LUT or both. If both, the 1D LUT definition should be before the 3D LUT definition.

Setup

The following parameters are used in the LUT file before the LUT data is defined :

TITLE

Format : STRING

 

LUT title. Use quotes if the title contains spaces.

 

Example :

 

TITLE "Title of LUT"

NUCODA_3D_CUBE

Format : INT

 

Integer format version of LUT file.

 

Example :

 

NUCODA_3D_CUBE 3

LUT_1D_SIZE

Format : INT

 

Size of 1D LUT.

 

Example :

 

LUT_1D_SIZE 1024

LUT_1D_INPUT_RANGE

Format : FLOAT FLOAT

 

Minimum and maximum 1D input values allowed: min1D max1D

Optional (defaults to 0.0 1.0).

LUT Format v3 Only

 

Example :

 

LUT_1D_INPUT_RANGE 0.0 1.0

LUT_3D_SIZE

Format : INT

 

Size of 3D LUT.

 

Example :

 

LUT_3D_SIZE 17

LUT_3D_INPUT_RANGE

Format : FLOAT FLOAT

 

Minimum and maximum 3D input values allowed: min3D max3D

Optional (defaults to 0.0 1.0).

LUT Format v3 Only

 

Example :

 

LUT_3D_INPUT_RANGE -1.000 4.000

 

dv_note

Note that min1D and max1D are the minimum and maximum input values that can be transformed by the 1D LUT. Similarly for the 3D LUT and min3D and max3D input values.

 

Input values outside these ranges are clipped to these ranges before lookup. There is no constraint on the LUT outputs.

 

The LUT data is specified after the header setup.

1D LUTS

A single 1D array per R,G and B component.

 

The LUT values will range between min3D and max3D.

 

dv_note

Earlier LUT versions use a different range : v1 is between 0 and M, v2 is normalised between 0 and 1.

 

In the file this is expanded into a single list of r,g,b triples ....

3D LUTS

The 3D LUT is an MxMxM array.

 

In the file this is expanded into a single list of r,g,b triples with red the fastest moving axis, then green, then blue.

 

An example of the RGB values in an EXR pipeline is shown in the diagram below :

 

app-3dlut-range-clamping

Example EXR RGB values pipeline.

File Format

From a sample file included : lut3d_2xN_noinvert_1D_only.cms

# Lut3D.exe <1D-size> <3D-size> <invert-green> <1d-3d-test>
# see Lut3D.cpp for details on optional arguments
 
NUCODA_3D_CUBE 2
 
TITLE "Identity Lut, 1D Only, Version 2 format"
 
LUT_1D_SIZE 2
 
0.000000  0.000000  0.000000
1.000000  1.000000  1.000000

 

dv_note

Comments start a line with '//' or '#' characters.

Format Description


// version, title and sizes of LUTs:
 
NUCODA_3D_CUBE version-number:int // version number
 
TITLE "colour-conversion-title:string" // optional title (in quotes)
 
LUT_1D_SIZE size-of-1D-LUTs:int // call this N
LUT_1D_INPUT_RANGE min1D:float max1D:float // optional
 
LUT_3D_SIZE number-of-levels-per-axis-in-3D-LUT:int // call this M
LUT_3D_INPUT_RANGE min3D:float max3D:float // optional
 
// specify 1D LUT: comes directly after the header specifications
red[0]:float green[0]:float blue[0]:float
red[1]:float green[1]:float blue[1]:float
red[2]:float green[2]:float blue[2]:float
...
...
red[N-1]:float green[N-1]:float blue[N-1]:float
 
// specify 3D LUT: comes directly after 1D LUT specification
// R lvl 0, G lvl 0, B lvl 0
red[0,0,0]:float green[0,0,0]:float blue[0,0,0]:float
// R lvl 1, G lvl 0, B lvl 0
red[0,0,1]:float green[0,0,1]:float blue[0,0,1]:float
// R lvl 2, G lvl 0, B lvl 0
red[0,0,2]:float green[0,0,2]:float blue[0,0,2]:float 
...
...
// red level M-1, green level 0, blue level 0
red[0,0,M-1]:float green[0,0,M-1]:float blue[0,0,M-1]:float
// R lvl 0, G lvl 1, B lvl 0
red[0,1,0]:float green[0,1,0]:float blue[0,1,0]:float
// R lvl 1, G lvl 1, B lvl 0
red[0,1,1]:float green[0,1,1]:float blue[0,1,1]:float
// R lvl 2, G lvl 1, B lvl 0
red[0,1,2]:float green[0,1,2]:float blue[0,1,2]:float
...
...
// red level M-1, green level 1, blue level 0
red[0,1,M-1]:float green[0,1,M-1]:float blue[0,1,M-1]:float
// R lvl 0, g lvl 2, B lvl 0
red[0,2,0]:float green[0,2,0]:float blue[0,2,0]:float
// R lvl 1, G lvl 2, B lvl 0
red[0,2,1]:float green[0,2,1]:float blue[0,2,1]:float
// R lvl 2, G lvl 2, B lvl 0
red[0,2,2]:float green[0,2,2]:float blue[0,2,2]:float
...
...
// red level M-1, green level M-1, blue level 0
red[0,M-1,M-1]:float green[0,M-1,M-1]:float blue[0,M-1,M-1]:float
// R lvl 0, G lvl 0, B lvl 1
red[1,0,0]:float green[1,0,0]:float blue[1,0,0]:float
// R lvl 1, G lvl 0, B lvl 1
red[1,0,1]:float green[1,0,1]:float blue[1,0,1]:float
// R lvl 2, G lvl 0, B lvl 1
red[1,0,2]:float green[1,0,2]:float blue[1,0,2]:float
...
...
// red level M-2, green level M-1, blue level M-1
red[M-1,M-1,M-2]:float green[M-1,M-1,M-2]:float blue[M-1,M-1,M-2]:float
// red level M-2, green level M-1, blue level M-1
red[M-1,M-1,M-2]:float green[M-1,M-1,M-2]:float blue[M-1,M-1,M-2]:float


Darrow-up.png     Previous Next