Nuke Custom LUTs

Problem

Our post-production facility receive DPX plates with .3dl LUT file from DaVinci Resolve. They provided two LUTs for two cameras one of which was ARRI Alexa and another was RED. The task is to apply this LUTs to every dailies rendered by artists.

Solution

First, we need to create a gizmo for each LUT which contain Vector Field Nuke node with the following expression in the “fectorfield file” field.

[getenv NUKE_LUT]/A_CAM_ArriLogC.3dl

where “getenv NUKE_LUT” will grab session environmental variable with name “NUKE_LUT” which contain path to the LUTs folder.

Nuke Vectorfield Example

Now create a “init.py” file inside you .nuke directory.

 C:\Users\{User name}\.nuke

The “init.py” file should look something like this.

import nuke
import os

# Path to executed file
cwd = os.path.dirname(os.path.realpath(__file__))

# Provide env variable for use in vectorfield node as a relative path
os.environ['NUKE_LUT'] = os.path.join(cwd, 'BB_LUT')

# Paths to viewer gizmos
RED_Viewer_LUT = os.path.join(cwd, 'BB_LUT', 'BB_RED_Viewer_LUT.gizmo').replace("\\", "/")
ARRI_Viewer_LUT = os.path.join(cwd, 'BB_LUT', 'BB_ARRI_Viewer_LUT.gizmo').replace("\\", "/")

# Paths to node gizmos
RED_LUT = os.path.join(cwd, 'BB_LUT', 'BB_RED_LUT.gizmo').replace("\\", "/")
ARRI_LUT = os.path.join(cwd, 'BB_LUT', 'BB_ARRI_LUT.gizmo').replace("\\", "/")

# Register custom LUTs
nuke.ViewerProcess.register("BB_ARRI_LUT", nuke.Node, (ARRI_Viewer_LUT, ""))
nuke.ViewerProcess.register("BB_RED_LUT", nuke.Node, (RED_Viewer_LUT, ""))

# Register custome menu for LUT gizmos
nuke.menu('Nodes').addCommand( 'BB_Tools/ARRI_LUT', lambda: nuke.createNode(ARRI_LUT))
nuke.menu('Nodes').addCommand( 'BB_Tools/RED_LUT', lambda: nuke.createNode(RED_LUT))

Beside registering gizmo for Nuke Tab menu I also register them as a custom Nuke display LUTs.

nuke lut node.png

Note how the “init.py” script setting a ‘NUKE_LUT’ environmental variable which is hold a path pointing to the current directory plus LUT sub-directory.

After that we should be able to access that variable trough the foloving TCL expression inside of Nuke.

getenv NUKE_LUT

Now we can copy the folder with our LUTs and gizmos within “init.py” to any windows or mac machine without worries about hard-coded path to our LUTs.