Colour space, and the many pitfalls
In compositing, colour issues are one of the things that give a lot of people the most hassle. They’re the kind of thing that a lot of people can cope fine not understanding entirely, but having a better understanding of the issues surrounding colour can really help your understanding of what is going on, both in your comp and what would happen in the real world.
Disclaimer: I am no colour scientist. If I’ve presented something here as fact and am completely off the mark on it, please do let me know.
Most of this post will be about colour spaces (that’s Log/Lin for most of you), but I’ll briefly talk about colour gamuts at the end.
In film, we’re usually given log plates. The log colour space was designed to replicate how the grains in celluloid change as light falls on them. For double the amount of light hitting the film, the log value in the image increases by the same amount (approximately 0.088, although the exact number appears to vary depending on who you ask).
Linear (or Linear Light, but I’ll call it Linear), on the other hand, is more related to the actual light hitting the film, rather than how the film reacts. If a pixel in a linear is twice the value of another pixel, then this is because that pixel had twice the amount of light hitting it.
Both Log and Linear are mathematical spaces. The values mean something, but don’t necessarily look good if you view an image on a monitor.
Some examples might be nice….
For all of these, I’m using Marcie (that link will give you a 2k Log image from Kodak)
Click on any image for a larger version
Neither of these look as they would if you saw this piece of film in a cinema. As I said before, they are both mathematical colour spaces, and so not necessarily for viewing. Shake, to use a tool I know as an example, comes with the Truelight node. This node is for converting an image from Log or Linear into an image that actually represents something that we would see, in most examples, if it were put on film and projected in a cinema. The Truelight node ought to have information about your monitor, but does come with a few pre-set display profiles. If you’re playing with this in Shake, have a look at it through the Truelight node. There are different profiles for the different types of film that you may be printing it to.
For example, Marcie, when printed onto Fuji 3510 film, would look like this (if you are viewing it on a Sony HD monitor, which I’m not either):
One area that often confuses people is that a lot of people who don’t work on film say that they are working in “Linear”. I beg to differ. I say that they are working in Gamma-Corrected Linear. (I mentioned “Linear Light” earlier - this is to differentiate it from Linear as called by people who work on TV/Video). Gamma-Corrected Linear is, as it’s name applies, Linear, with a gamma curve applied to it to make it more viewable. This is another viewing colour space, and, in my opinion, shouldn’t be worked in (although often is).
Marcie in Gamma-Corrected Linear, with a gamma of 2.2, looks like this:
![]()
What I’m focussing on here, though, is why we work in Log or Linear.
When we composite, we are dealing with light. We are not, with one exception, thinking about what is happening inside the actual celluloid itself. So, as Linear is directly related to the amount of light, it makes sense to do our compositing in Linear.
The one exception is adding film grain. Because this is actually happening inside the film, this is always done in Log.
One other possible exception is grading. Grading can be done in either Log or Linear. Earlier I mentioned that twice the amount of light hitting the film meant 0.088 extra in log? This is why grading in Log should always be done using Add nodes (or your tool of choice’s equivalent). You want to brighten it up by a stop? Add 0.088. Darken by a stop? Subtract 0.088. Add half a stop of red? Add 0.044 to the red channel.
If you’re grading in Linear, it’s Mult that you should be using. Instead of Adding 0.088, Mult by 2.0. Instead of subtracting 0.088, Mult by 0.5.
If anyone’s got more thoughts on why grading should be done in either Log or Linear, please do let me know - I’d love to get other peoples’ thoughts on this one….
So, other than grading and graining, why should everything be done in Linear? Because, as I mentioned before, and I’m sure you know already, most of compositing (the “making it look real” part, anyway) is about replicating how light would interact were the scene you’re creating real. You’ve got something behind glass, and a reflection on the glass? In real life, what you’d see would be the light coming through the glass added to the light reflecting off it. So, in Linear, you can just add the two things together. (Screen, in case you’re wondering, is a non-accurate simulation of this, but gives a reasonable result when used in Gamma-Corrected Linear)
Working with CG also generally requires linear. 3D renderers will be calculating the light in linear, and, while they often (well, Maya’s software rendered does, at least) add a gamma curve on, for proper integration with an environment, linear is the best way to go.
That’s about it - if there’s anything I’ve not been clear on, please do let me know in the comments, or (probably more likely) if there’s something that you think I’ve misunderstood myself, please do similarly.
May 20th, 2007 at 0:40
Really good post. Wish info like this had been out there when I was figuring all this stuff out on my own
About the grading. If you’re simulating sticking a filter in front of the camera lens what you have is quite right. But these days people tend to do rather more horrible and complex things in their grades, like shadows and midtones adjustments
So doing things the “wrong” way can do quite normal and accepted things - such as tinting the highlights without affecting the shadows and midtones like a filter would, which you can do with a Mult in log or video space. Grading is always (as far as I know) done in a perceptually uniform-ish rather than physically accurate space because it’s easier to grab hold of bits of the tonal range that we see as being distinct - so usually three bands, shadows mids and highlights. Traditionally done with the classic three balls and three rings of a TK desk, which are Add, Gamma and Mult, in video or log space. Gamma is especially horrible to use in Linear… if you stick our friend Marcie through Shake’s ColorCorrect and look at what all the knobs do to the histogram, in linear it’s hard to get seperate control over the blacks and the midtones while in log that works pretty well.
wow i’m rambling and it’s bedtime…
L
August 12th, 2007 at 21:58
Good article, but I’m a little confused about:
“The one exception is adding film grain. Because this is actually happening inside the film, this is always done in Log.”
If you’re adding grain in shake, presumably just to comped in elements in order to match the grain to a plate, then doing a filmout, the grain you add isn’t ‘inside the film’ any more than any other digitally added element, right? So does it really matter whether it’s done in Log or Lin space, as long as it visually matches the plate’s grain?
August 12th, 2007 at 22:21
When doing the grain in comp, you’re right, it’s not actually in the film, but what we’re trying to replicate is the grain that was being done in-celluloid, as opposed to the light hitting the film, which was scene-based, and therefore linear.
The FilmGrain node in Shake was designed to work in Log, although, if you can get the same result in Linear, then great, but I’m pretty sure that it would be a much harder task.
The grain in film is the slight variations in the density of the film (which is what Log approximates) as opposed to variations in the light hitting the film (which is what Linear trys to emulate)
March 16th, 2008 at 16:49
[…] Links: Espacios de color Corrección de color secundaria […]