Transforming the Color Space

Whenever you read a clip into a script, it is automatically converted to Nuke’s native color space, which is 32-bit per channel RGB, a linear format. This conversion takes place even if the clip you read in is in the Kodak Cineon format, which is a logarithmic format.

The reverse of this conversion, called a lin-to-log conversion, also automatically takes place when you write the processed element back out of the script - that is, Nuke automatically converts it back into a Cineon element.

Article:  See Knowledge Base article Q100319 for more information on colorspace in Nuke.

Overriding the Default Cineon Conversion

Nuke uses the Kodak-recommended settings when making Cineon conversions in either direction. It’s rare that you would want to override these settings, but if it becomes necessary you can use Nuke’s Log2Lin or PLogLin nodes.

To Override the Default Cineon Conversions Using Log2Lin

1.   Double-click on the Read node of the Cineon element whose conversion you wish to override.
2.   In the Read properties panel, set the Input Transform dropdown menu to linear. This halts the automatic log-to-lin conversion.
3.   Click Color> Log2Linto insert a log2lin node directly after the Read node.
4.   In the Log2Lin properties panel, set the operation dropdown menu to log2lin.
5.   Set black, white, and gamma to the appropriate values.
6.   Copy the Log2Lin node and insert it just before the element’s Write node.
7.   Open up the properties panel of the second Log2Lin node and set the operation dropdown menu to lin2log. This gives you the reverse of the conversion you created above.
8.   Double click on the element’s Write node.
9.   In the Write properties panel, set the output transform dropdown menu to linear. This halts the automatic lin-to-log conversion and lets the one you create above have priority.

To Convert Between Logarithmic and Linear Color Spaces

You can also convert between logarithmic and linear color spaces with the PLogLin node. This alternative method is better known as the Josh Pines log conversion, and it’s based on using a single gray value, rather than a black and a white one, like in the Log2Lin node. To use the PLogLin node:

1.   Much like with the Log2Lin node, when you’re using the PLogLin node you need to first make sure your Read or Write nodes aren’t automatically converting your color space. To do this, click on your Read or Write node, and select linear in the Input Transform or output Transform dropdowns.
2.   Create a PLogLin node by clicking Color > PLogLin. Connect it to either your Read node’s output or the Write node’s input, depending on which one you’re converting the color space for.
3.   In the operation dropdown, select the operation you want PLogLin to perform. Select log to lin to convert from logarithmic to linear, and lin to log to do the reverse.
4.   Adjust the linear reference value slider to the linear value that corresponds with the logarithmic reference value and the log reference value slider to the value that corresponds with the linear reference value.
5.   You can also adjust the film response gamma value in the negativegamma field, and use the densitypercodevalue field to tell PLogLin what type of change occurs in the negative gamma for each log space code value when converting.
6.   If you need to, you can pick a channel in the (un)premult by dropdown to divide the image first with that channel and then multiply it again afterward. Doing this can sometimes improve your color correction results on anti-aliased edges.
7.   You can also use the mix control to dissolve between the original input (value 0) and the full effect of the PLogLin node (value 1). If you only want to use one channel for mixing, you can specify that using the mask control.

To Create a 3D LUT in Log Color Space (for example Cineon)

For good visual fidelity when using 3D LUTs, it is recommended that a log color space is used for 3D LUT generation. To create a 3D LUT in a log colorspace (Cineon in this example):

1.   Create a CMSTestPattern node at a required density.
2.   Connect this to a Colorspace node to convert input: Cineon to output: Linear. This is a reverse log conversion, and gives a higher density of samples in the shadows of your grading curve, with reduced density in the highlights.
3.   Connect the Colorspace node to your grading nodes.
4.   Connect the grading nodes to another Colorspace node to convert input: Linear to output: Cineon. This is the log conversion, and converts the grade samples back to the normalized range (0-1) for 3D LUTs.

It is important to distribute the samples appropriately due to the low resolution of 3D LUTs.

5.   Connect a GenerateLUT node to the last Colorspace node.

Tip:  To reproduce the grade, set a Vectorfield node to Cineon for both the colorspace in and colorspace out controls.