Using Color Lookup Tables (CLUTs)

What is this all about?

Color Lookup Tables – CLUTs (also “Color LUTs“) are a method of storing and reusing complex linear color transformations*.
CLUTs have the advantages of being supported by many video and image processing software packages, and also the ability to be calculated in real-time on the GPU, costing very little computing resources.
* More simple, daily use terms can be: “color styles”, or “color corrections”

CLUTs are used in the movie production industry to perform color conversions of images acquired from different sources for monitoring and editing purposes, and also for testing, applying and sharing different creative color styles across different departments, and stages of the production.
Examples of common CLUT file formats are *.3DL and *.CUBE

Why is this called a “3D” or “Cube” Lookup Table?

The reason CLUTs are referred to as “3D” color lookup tables or “Cube LUT” is that they store the effect of color operations as linear transformations of a 3D cubic space.
To understand this we have to imagine RGB color encoding as a 3D space with the R, G and B values of each color being coordinates in this cubic color space.
This means that the color correction operations we perform to create a color style, like adding contrast, saturation, warming the hues etc. are all defined as a function that for every color coordinate in the RGB color cube space defines the new coordinate where the corrected or stylized color is found.
The term Lookup table means that the new color values don’t have to be calculated every time because they have been pre-calculated and stored in a table of values.
3D CLUTs are often processed and stored as 3D Cubic textures like this example generated with Blackmagic Fusion of a 32 x 32 x 32 value CLUT.
Imagine the little 32 x 32 square patches all stacked one upon the other, that would create a 32 x 32 x 32 RGB color cube, with which color transformations can be stored by simply applying them on this texture:Cube0000

Working with CLUTs:

In this post we’ll go trough the process of creating and using a CLUT in some popular creative software packages.
* Note that there are many other software packages that support creation and usage of CLUTs, the process should be similar.

Steps shown in the following software:
Adobe Photoshop 2020
Adobe After Effects 2020
Adobe Premiere 2020
Blackmagic Design Fusion 9

In this example our source image with which the CLUT will be designed is an interior scene modeled with Blender 2.82 and rendered with Cycles Render Engine with “Filmic” tone-mapping applied, saved as a PNG file.
* I usually save Linear unclamped 32bit float EXR files as the raw output from render engines, because this is the format that provides the most freedom to manipulate and process rendered images and animation, but from my experience CLUTS don’t work well on linear unclamped color, for that reason I usually apply them at a later stage of the image development (usually after applying tone-mapping to the image).
This is why I saved the file directly as a tone-mapped PNG for this example.

A.Test_Image

Creating a CLUT in Adobe Photoshop:

For this example, a greenish-contrasty-desaturated color style is created in Photoshop by applying color adjustment layers to the image.
In this case Color Balance, Vibrance, and Curves.
* You can use different numbers and combinations of color adjustments

B.Photoshop_Grade

The new Color Style is now exported to CLUT files:

C.Photoshop_Export_CLUTS

In the Export Color Lookup Tables dialog allows naming the CLUT, adding a description, setting a quality for the color transform it will define, and selecting the wanted CLUT file formats that will be written.
After clicking OK the CLUT files will be saved in a chosen location.C1.Photoshop_Export_CLUTS

Note:
Saving the CLUT in the Presets\3DLUTs folder (found in the Adobe Photoshop installation folder) will allow reusing the CLUT as a preset look available by drop-down selection without having to locate the file each time.

Applying a CLUT in Adobe Photoshop:

With the image later selected, add a Color Lookup adjustment layer:

D.Photoshop_Lut_Adjustment

In the Color Lookup adjustment properties, open the 3DLUT File drop-down, choose Load 3D LUT, and locate the CLUT file you saved:E.Photoshop_Lut_Load

The original image now has the same color style we created earlier, but this time it’s applied by only a single Color Lookup adjustment layer:

F.Photoshop_Lut_Correction

An example of the same CLUT applied to a different image:

F1.Photoshop_Lut_Correction_B

Applying a CLUT in Adobe After Effects:

Add a Util > Apply Color LUT effect to a layer,
In the Effect Controls window, click Choose LUT and locate the wanted CLUT file:

G.AE_Apply_CLUT

Applying a CLUT in Adobe Premiere:

  1. Select the image/video clip in the timeline.
  2. Switch to the Color UI tab to get access to the Lumetri Color controls on the right.
  3. In the Creative section of the Lumetri Color controls, open the Look dropdown, choose Browse and locate the wanted CLUT file.

I.Premiere_Apply_CLUT

I.Premiere_Apply_CLUT_B

Applying a CLUT in Blackmagic Design Fusion:

Add a LUT >File LUT node to the image source.
In the File LUT properties, click the browse button and locate the wanted CLUT file:

H.Fusion_Apply_CLUT

Creating a CLUT in Blackmagic Design Fusion:

* See the numbered nodes in the flow graph below

  1. Source image/video on which the CLUT is designed.
  2. A LUT Cube Creator node, generating default neutral 3D CLUT data in the form of a Color Cube map.
  3. The nodes creating the actual color style (in this case a Color Corrector and Color Curve nodes) are operating on the LUT Cube Creator node’s output.
  4. A LUT Cube Apply node is applying the stylized CLUT data to the image/video for previewing purpose (displayed on the right viewer)
  5. A LUT Cube Analyzer node generates CLUT data from the styled LUT Cube Creator data, and allows saving it to disk as a CLUT file.
    * Choose a location and click Write File to save the CLUT file.

K.Fusion_Create_LUT

Media Encoder – 8K video & 8K 360 VR video for YouTube

Software:
Adobe Media Encoder CC 2018

Recently YouTube added support for uploading HEVC H.265 video encoding.
That’s great news for anyone wanting to upload 8K video from Adobe Premiere Pro CC, or After Effects CC, because there’s no need to use inconvenient third party workarounds and plugins like WebM, DNxHD etc.
Abobe Media Encoder doesn’t allow encoding H.264 at higher than 4K resolutions*, but has native support for HEVC H.265 that does allow 8K encoding.
* There’s a commercial plugin that encodes H.264 at 8K.

Another convenient & time saving feature in the Adobe Media Encoder H.265 output module is the option to add panoramic VR video meta-data to the file eliminating the need to use meta-data “injection” utilities,
So uploading 8K stereo 360 VR video to YouTube became completely hassle-free 🙂

Untitled-1

 

Exporting 3D camera data from After Effects to 3ds max

Software:
After Effects 2020

  1. Download the AE3D_Export script here:
    http://www.urbanspaceman.net/shared/AEscripts/AE3Dexport/AE3D_Export.jsx
  2. Perform 3D tracking on the footage if necessary.
  3. Select the 3D Camera layer and also Null layers if available.
  4. Choose File > Scripts > Run Script File and locate the AE3D_Export script.
  5. In the Script parameters highlight 3ds max.
  6. Click Options and set the scale.
    * you might need to try and see the scale in 3ds max to set it right.
  7. Set a name for the exported ms (MaxScript) file.
  8. Click Export.
    The resulting MaxScript file will appear on the desktop named <your after effects project name>.ms
    Note:
    You may be prompted to check the Allow Scripts to Write Files and Access Network option in File > Preferences > Scripts & Expressions.
  9. Drag the generated MaxScript file into the 3ds max viewport.
    The script will run and create an animated Camera and Dummy object, and also set the timeline range to fit the animation.
  10. Create a new Point Helper object.
  11. Align the new Point Helper to the Dummy object in both position and orientation.
  12. Group the Camera and the Dummy objects together, and link the group to a new Point Helper.
    This will allow for easy orientation and scaling.
  13. Set the Point Helper object’s rotation to default (0,0,0) , this will also reset the Dummy + Camera group’s orientation relative to the world.
    Scale the Point Helper object if needed, to scale the whole camera setup.
  14. Display the original video sequence as viewport background to check how the camera motion fits the video.
    The center of your Point Helper should appear “glued” to a specific point in the background video. 
Untitled-2

 

Related:
After Effects 3D Camera tracking

3D Tracking in After Effects

Software:
After Effects 2020

  1. Select the footage layer in the composition and choose:
    Animation > Track Camera.
    * A 3D Camera Tracker effect will be applied to the layer, tracking will be processed, and when finished tracking points will be displayed.
  2. Hover over the tracking points and click to select a planar position, a location where the round icon is placed between 3 planar tracking points.
    * If you don’t see the tracking points make sure the 3D Camera Tracker effect is highlighted in the layer’s Effect Controls.
  3. Right click and choose Create Null and Camera.

Related:
Export 3D camera data to 3ds max

Extracting image layers from a multi-channel EXR file sequence in After Effects

Software:
After Effects CC 2018

  1. Apply an EXtractoR effect on the layer.
    * Effects > 3D Channel > EXtractoR
  2. In the EXtractoR effect parameters, Click the RGB Channels to open the EXtractoR dialog box.
  3. Choose the wanted layer from the Layers drop-down, or select individual channels from the B, G, B, Alpha drop-downs.

Note:
The Layer will be displayed darker than the original EXR main layer display because it will not be Gamma corrected (linear display).
A Gamma correction should be applied on the result of the composite via an adjustment layer or ‘pre-comping’ the layers and applying it on the containing composition.
* A Gamma correction can be applied using a Levels effect.
* In most cases the Gamma correction need to be with a value of 2.2 (sRGB).

Untitled-1.jpg

After Effects Keylight with garbage masks

Software:
After Effects CC 2018

Creating Inside and Outside garbage masks allows better and easier keying because the keying parameters can be focused for the best result at the contours areas.

  1. Apply the Keylight effect and, sample the screen color and adjust Screen Gain optimize it for the contours area.
  2. Create an ‘Inside’ garbage mask, name it, and set its mode to ‘None’.
  3. Create an ‘Outside’ garbage mask, name it, and set its mode to ‘None’.
  4. In the Keylight effect properties, under ‘Inside Mask’, select the inside mask you created.
  5. In the Keylight effect properties, under ‘Outside Mask’, select the outside mask you created, and also check Invert if needed.

A

B

C.jpg