How to make 3D LUTs in Nuke (R´B´G´to X´Y´Z´)

Updated in 2016 with some clarifications

The built-in SRGB TO XYZ conversion used in some DCP conversion software does not have the correct color science.

See this post for more info.

The included XYZ 3D LUTs in this post show you can generate 3D LUTs using the color science math from the REC709 example on page 42 in the “SMPTE Digital Cinema White Gamut Practices Study Group Report” by Rod Bogart and Rick Sayre.

The R´G´B´ values 4095, 4095, 4095 end up as 3883 3960 4092 in X´Y´Z´

The “SMPTE Digital Cinema White Gamut Practices Study Group Report” from 2009 concluded that the color science used to make some commercial DCPs around 2008 was not correct (out of gamut).

The color science is explained more in SMPTE EG 432-1:2010

They explain how to use D55, D60, D61, and D65 as mastering whites and how these white points fit inside X´Y´Z´. They explain that DCI White is not necessarily the mastering white.

With SMPTE 431.2:2011 they made a new projector configuration file (PCF) standard that is called Virtual White.

The DCI specifications say that the projectors in cinemas should follow SMPTE 431.2:2011.

Update 2016

The color science math for RGB to X´Y´Z´ in this post produces the correct values for white in X´Y´Z.

In NUKE you can make 3D LUTs for Resolve and other software that have 3×3 SMPTE RP-177 color matrix conversions, gamma conversions, and multiplications baked in.

The generateLUT node is disabled in NUKE non-commercial (formerly PKL).


Blackmagic Davinci Resolve

Example 1:
Making a REC709/SRGB R´G´B´to DCDM X´Y´Z´ 3D LUT for Resolve:

How to make a R`G`B` to X´Y´Z´ 3D LUT in NUKE:

-In the CMSTestPattern node I used a Cube size of 65, alternatives are 33 or 17.

-Linearize the R´G´B´ to RGB with a gamma function in a Gamma node: Example: 2.4 simplified gamma function= 0.416667
Alternative: SRGB 2.2 simplified gamma function=0.45

-Apply the rec709/SRGB RGB XYZ to RP-177 3×3 NPM color matrix in a ColorMatrix node.

The NPM from Matlab after doing the RP-177 math is:
0.412390799265959 0.357584339383878 0.180480788401834
0.212639005871510   0.715168678767756   0.072192315360734
0.019330818715592   0.119194779794626  0.950532152249661

The middle row sums to 1.

The NPM after copying and pasting into the Nuke colormatrix node:

0.4123908  0.35758434   0.18048079
0.21263901 0.71516867   0.07219232
0.01933082 0.11919478   0.95053215

This is very similar to the example.

The middle row should sum to 1 according to RP-177 so I changed 0.71516868 to 0.71516867.

-Apply the normalizing constant multiplication in a multiply node. Luminance (48) divided by the normalizing constant (52.37) = 0.91655527
After pasting it into nuke it is shortened to:

-Apply the DCP 2.6 gamma in a Gamma node to get X´Y´Z´ values.

-In the GenerateLut node I put: .3dl, 12 bit in/out, 3dl file format
Autodesk flame/smoke.
Alternative: 16 bit.

The values for 4095,4095,4095 in the resulting 3D LUT (12 bit 3dl integer file) is:
3883 3960 4092


This is the correct result for D65 in X´Y´Z´
and it is the same result as in the example conversion.

With this 3D LUT you are inside the Virtual white X´Y´Z´ gamut (DCI/SMPTE 431.2:2011 compliant).

To convert this 3D LUT to a floating point.Cube 3d LUT that is compatible with Photoshop, Resolve, and After Effects I used opencolorio.
In terminal on a Mac I use this command to convert the 3D LUT:

ociobakelut -lut srgbtoxyz.3dl -format iridas_itx -cubesize 65 srgbtoxyz.cube

to install opencolorio/ociobakelut I used these commands on a mac:

/bin/bash -c "$(curl -fsSL"
brew doctor
brew install opencolorio

Get the free REC709/SRGB 3D LUTS files here
It includes the 2.2, 2.4, 2.6 Gamma CUBE REC709 LUTs.

Usage in Resolve (updated for Resolve 11)

The CUBE LUT can be placed in a folder you call Nuke or DCP inside Resolve´s LUT folder:
On a Mac: /Library/Application Support/Blackmagic Design/Davinci Resolve/LUT
On a PC: C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\

In Resolve you can apply it to the timeline from:
Project settings – Timeline Lookup tables – 3D Output Lookup table
or you can use a corrector node
You can also apply them to clips.

You can render DCPs directly from Resolve Studio. If you choose DCI X´Y´Z´ in the timeline color space no color transform will be applied and you can use the 3D luts to DCI X´Y´Z´ from this post.
See this post for more info.

Or export to another format and use it in Fraunhofer Easydcp .

Usage in After Effects
The resulting 3D LUT converted to.CUBE can be used in a non-linear 32 bit Adobe After Effects CC project
with the apply color LUT effect
when exporting 16 BIT TIFF or similar

3DL LUTS in Easydcp
The 3DL 3D LUT can be applied in Easydcp.

In Easydcp Creator 2.2 you have the option to make custom color transformations. You can modify the 3×3 matrix, gamma, and normalization constant/multiplication to suit your workflow. 3D LUTs have these color transformations baked in.
Read more about the custom color transformations in this post.

Example 2.

P3D65 to X´Y´Z´
The same example as I used in this post.
This 3D LUT can be used with Arri Alexa material that has the
C-log P3 D65 to video 3D LUT applied.
Link:Arri lut generator

Changed the color matrix node to:

The DCI-P3 D65 NPM from Matlab after doing the RP-177 math:

0.486570948648216 0.265667693169093 0.198217285234362
0.228974564069749 0.691738521836506  0.0792869140937450
0                                        0.045113381858903   1.043944368900976

The NPM after copying and pasting into the Nuke colormatrix node:

0.48657095  0.26566769  0.19821729
0.22897457  0.69173852    0.07928691
0                       0.04511338    1.04394437

The middle row sums to 1
0.22897457+0.69173852+0.07928691 = 1

It is similar to the P3 D65 NPM from SMPTE EG 432-1-10


Changed the gamma function node to 1/2,6=0.384615385 for P3
It becomes 0.384615 after pasting into Nuke.

Get the free P3 D65 3D CUBE LUTS files

3 thoughts on “How to make 3D LUTs in Nuke (R´B´G´to X´Y´Z´)”

  1. Jeff Dobson

    Hello Knut,

    Thanks for the good information in this post.

    I have a question about generating a 3D lut to use in resolve to convert from XYZ back to RGB color space.

    In easy DCP player there are XML files to convert XYZ to P3 or rec709 – is it possible to use these files to create a LUT for resolve that can make the conversion from XYZ back to P3 or to rec709?

    If I was needing to create a file from a DCDM source – it could be nice to use the settings from easyDCP player and apply those to the DCDM and export from Resolve.

  2. Knut Erik Evensen

    Easydcp player supports color transformations using the same kind of math as in these examples. Update: The CMSTestPattern node is RGB so it would be harder to make a XYZ to RGB 3D LUT using this method.

  3. Hi,
    Your site is a brilliant source of information that has helped me enormously.

    I wanted to ask your advice.

    I am running EasyDCP, including the EasyDCP player.

    When I test DCPs, I need to include an XYZ color transform.
    When I do so, it slows down the playback, so it skips frames.

    I was thinking of getting an AJA LUT-Box
    That way, I could output through the Blackmagic card without the transform, then use the box to apply the LUT.

    Any reason why this wouldn’t work?

    If I do this, all I would need is an XYZ to RGB Lut.
    There are a few LUTs out there for RGB to XYZ. But I can’t find the inverse LUT.

    Do you have any ideas where I might find one?


Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.