When to Utilize a Different Colourspace

Categories Nuke

When compositing, it can help to switch to a different colourspace to get the result you’re after. This article intends to gloss over the basics of what each colourspace is actually doing to your image (I’ll provide links for further reading, if you’re interested), and instead provide practical examples of how different colourspaces can help you achieve better results.

Logarithmic Colourspaces

We should start with some quick, basic information for our less-experienced readers: Converting a linear image to a logarithmic one (log space) is compressing the full range of an image down to values between 0 and 1, whilst maintaining the relationship between all the pixels (the gamma changes but the image will still make sense to look at). Doing so will make your image look flat and grey, although will provide you with more fidelity in your image. Any plate you receive will have been shot in some flavour of log space as it maximizes the detail a camera can capture in the brightest highlights and darkest shadows. This plate is linearized when it enters the VFX facility so you, the humble artist, can work in a way that makes mathematical sense. There is a whole other, incredibly lengthy article that could be written about log space & LUTs, but I’ll leave that for another time…

Now, let’s dive into how any of this is relevant in your day-to-day comps. If plates are linearized because working in log space makes no sense, why would you want to convert your image back to log space? The answer is, to retain detail in any shadows or highlights. Examples would include:

  • To see more hair or edge detail over a bright background (like a sky or light source).
  • To pull an accurate key for a plate shadow, so combining a CG shadow pass with it is less painful.
  • To reduce the brightness of spec highlights on a sweaty actor’s forehead (stop laughing, I’ve been asked to do this more than once!)

Additionally, the most common example of when you would want to convert your image to log space is to prevent image filtering artefacting (e.g. when reformatting or transforming your image with a sharpening filter like Rifman). This solution is so common that most studios already have the methodology built into their pipeline somewhere, for example, when reformatting a plate or a comp script from native to delivery resolution.

Before
After

If you know which camera & colourspace the plate was shot with, you can get a better result by using their specific flavour of log space. For example, a plate shot with an ARRI Alexa will work more predictably if you convert linear > AlexaV3LogC using an OCIO ColorSpace node vs. a simple lin2log node / operation.

Lastly, be aware that some nodes aren’t optimized to deal with values over 1. If you’ve ever looked at an over-bright greenscreen & can see the difference in hue between the greenscreen and highlights in the foreground, but Keylight can’t seem to differentiate them, this is why. The math is optimized to work on values between 0 and 1, so if you convert said plate to log space & try the same key again, you’ll often find you’ll get a smoother result and a more-accurate despill.


Image Component Colourspaces

If you have ever used the Colorspace node in Nuke, you’ve likely noticed a bunch of colorspaces available that just look like jumbled letters. These options convert your Red, Green and Blue channels into different components of an image.

HSL converts Red > Hue, Green > Saturation and Blue > Lightness. This colourspace is the basis of how any hue or saturation keyer works in Nuke — you might use it to isolate & change a certain colour in your plate. Maybe you could make your own, more-powerful HueKeyer gizmo?

HSV is the same as HSL, except the V stands for “Value”. There is a difference between luminance and value based off the math used, but it’s a similar concept. If you multiply the blue channel in HSL vs HSV colourspace (blue channel, because Blue has been converted to Value), you’ll notice that HSV produces a similar result to just multiplying your image the regular way, whereas HSL appears to desaturate the highlights as they get brighter. HSV also seems to give a flatter, more diffuse look to the saturation values, so you’d probably want to use HSV over HSL in most cases.

If you’re curious to read more in-depth history, math & technical information, Wikipedia is always a great place to start.

(Look at those JPG compression artefacts! Funny how they’re almost invisible looking at the image in regular sRGB, but crazy when the image is broken into different components… This is the logic behind how compression algorithms work!)

YCbCr breaks down Red > Luminance, Green > Blue-Difference Component and Blue > Red-Difference Component. This is how CRT monitors process information & turn them into coloured images, and is the basis behind compression standards like JPEG & MPEG4, as YCbCr makes it easy to get rid of some redundant colour information. Again, Wikipedia is a great resource for easily digestible information if you’re curious to learn more about the technical side of all this…

So what can we do with the YCbCr colourspace in Nuke?

  • By significantly blurring the Red channel (luminance), you can be left with only colour information. This is similar to having a diffuse or RAW texture AOV as you might receive with a CG render.
  • By blurring the Green & Blue channels (Blue-Difference Component and Red-Difference Component), you can “bleed” the colours out of your image like Skittles in water. Doing this can be handy when trying to blend a CG character with a plate, or the edges of a keyed image with a different background.

Converting to the L*a*b colourspace expresses colour as Red > Luminance, Green > Green-Red and Blue > Blue-Yellow. I’ve only ever used this colourspace for sharpening an image via the LabSharpen gizmo or for denoising an image. It gives a much nicer result than the standard Sharpen node in Nuke by avoiding the harsh dark banding, and bypasses the colour bleeding you get when trying to sharpen an image in log space. Once again, you can read more about L*a*b colourspace on Wikipedia.

Lastly, the “Luminance” math is calculated differently depending on which colourspace is in question, so if you ever need to adjust (or sharpen) only the luminance of an image, it would help to try all the options to see which provides the cleanest results.

If you’d like to learn more about the basics of colourspaces in general, Khan Academy has a great, free introductory course on colour science which I’d highly recommend.

1 thought on “When to Utilize a Different Colourspace

Comments are closed.