In practical terms, Linear Workflow refers to a rendering workflow in which image gamma is carefully taken into account in order to ensure proper light computations in a render. As computer graphics rely on mathematics and light works linearly in the real world and therefore only works properly when it lights linear values, this is the correct mathematical workflow to be used. It is not based on aesthetics but helps build the most convincing foundation from which one can start adding their own artistic touch.
This is called also a Physically Based workflow. Just mind the "based" part - when something is mathematically correct it doesn't necessarily mean it is a law set in stone, remember that the "artistic touch" is also important.
First we need to know what Linear Color Space is. Simply, it means that numerical intensity values correspond proportionally to their perceived intensity. Colors can be added and multiplied correctly. Mathematics work as they should. A color space which doesn't follow the logic of simple mathematics is called Non-Linear. Below is an example where an intensity value is doubled in a Linear and a Non-Linear color space. While the corresponding numerical values in linear space are correct, in the non-linear space (gamma = 0.45, more on this later) we can’t simply double the value to get the correct intensity.
Gamma is the term used for a power function applied on every pixel of an image. What happens visually is lightening or darkening of the midtones. This means that the image will from then on exist in a Non-Linear space - where mathematics don't work as they should.
Example: Let's use a Mid-Grey color. In linear space, Mid-Grey = 0.5. Let's now apply Gamma = 2. We have 0.52 = 0.25 - the color will be darkened.
So, the question here is - why would you want to change the linear characteristics of an image in the first place? There are a couple of issues that made this a necessity:
When CRT monitors were firstly introduced, they were made in such a way that they didn't have a linear response to light intensity. They were effectively darkening linear images. As this has become a standard, modern LCD monitors are able to mimic the old CRT displays, even though they can display linear images properly.
The human eye can tell the difference between darker shades better than lighter shades. This means that when images are compressed to save space, we want to have greater accuracy for dark intensities at the expense of lighter intensities.
When people found out that CRT monitors display images too dark, they started color correcting them until they got it right. It turned out that the law of this correction was similar to the mathematical power function, whose graph is a parabola.
Then sRGB standard was established for digital pictures. It compensated non-linear darkening of the image on screens using Gamma. So, monitors darken picture with Gamma about 2.2 and sRGB pictures are lightened with gamma 0.45(45) (or 1/2.2) to look linear on CRT displays.
Gamma = 1 is a correct linear image. Monitors darken it with a Gamma = 2.2. To compensate for this we apply an inverse power function Gamma = 0.45 to effectively lighten the image. The image is now displayed correctly, however it is now in Gamma space.
When a camera takes an image, it automatically lightens it using Gamma - these images usually are in sRGB color space (a form of a Gamma space). In fact, most images you will find on the internet and on your computer are in Gamma space and have an sRGB color profile embedded in them. Note that sRGB is not the only color space or profile that can be used but as it is the most common, it will be the color profile used throughout.
Float images (images with floating point precision per channel) are assumed to have no color profile, such as EXR, HDR or Float Tif. This is the default for most HDR and painting/ sculpting applications.
Before we continue to why do we need to know all of this, it is quite important to know that computer software operates by inverted gamma (gamma-correction) instead of gamma, so, when you want to make midtones lighter, you can intuitively increase the Gamma parameter and get result you expect. This is just so your head can start spinning a little bit if it hasn't already.
Programs like Photoshop, 3ds Max and Fusion work like this. It means that a Gamma = 2.2 will actually lighten and image, rather than darken it. Logically, inverse Gamma will darken images.
This is how Gamma is treated in software - the same maths happens in the background, but the values we input are swapped for more intuitive use. Increasing Gamma will also increase image brightness.
Light in the real world works linearly and therefore only works properly when it lights linear values.
A Linear color space is one that follows the laws of physics and mathematical equations work as they should.
Linear images appear too dark because of how our monitors work. We need to apply an sRGB curve or Gamma 2.2 to make images suitable for viewing.
When it comes to rendering or compositing, we can split the process into three simple steps:
For linear workflow to work properly, all calculations need to happen in linear gamma, but all viewing (input/ output) needs to happen in sRGB gamma.The following diagram illustrates this:
The main problem when rendering without a proper Linear Workflow is that lights look overblown and colors look unnatural. The artist then tries to adjust their scene's lighting, falloff, colors etc. However this is only possible to a certain extent. The images below show common mistakes people make when rendering out images with differing gamma inputs/outputs:
No INPUTS are color managed, therefore all the CALCULATIONS happen incorrectly and the OUTPUT display is linear. Which translates into wrong colors, wrong light and wrong display.
This is incorrect.
No INPUTS are color managed, therefore all the CALCULATIONS happen incorrectly, but the OUTPUT display is in sRGB. Which translates into wrong colors, wrong light, but proper display.
This is also incorrect.
All INPUTS are color managed, therefore all CALCULATIONS happen correctly and the OUTPUT display is sRGB. Which translates into correct colors, correct light and proper display.
This is correct!
Now that we've hopefully established what is the correct workflow we can see how we can translate this knowledge on to specific programs.
For proper Linear Workflow all calculations need to happen in Linear space
Input textures need to be Gamma-managed
Renders need to be viewed in sRGB Gamma space