Linear Workflows and Color Management

Linear workflows are an approach to shading, lighting, and rendering that offers many advantages over working directly with non-linear video values such as sRGB. Color management enables a linear workflow by properly converting colors between the different color spaces used for input, rendering, display, and output.

Color spaces specify a color unambiguously in terms of the primary components, as well as the white point, encoding, and other attributes. For example the primary red, green, and blue values used for an sRGB image on a web page are different than those used by a P3 digital cinema projector, and the surrounding light conditions for web and cinema viewing are also different. Nevertheless, it is possible to accurately convert colors for display on either a standard monitor or a projector because both the sRGB and DCI-P3 color spaces are well characterized. However to interpret an RGB triplet like (0.5, 0.25. 0.25) properly, its intended color space must be known.

Modern renderers mimic how light transmission, absorption, reflection, and refraction work in the real world. The lights in a 3D scene should therefore closely match real lighting, whether that is outdoors or in studio, where the color values are directly proportional to the amount of light energy — this is called a scene-referred linear working space, or scene-linear for short. In such a color space, there is no maximum brightness: (1.0, 1.0, 1.0) is the color considered to be "white" by a typical observer who is fully adapted to the lighting, but light sources and specular reflections can be much brighter.

However, display devices do have a maximum brightness that is also denoted by (1.0, 1.0, 1.0), or (255, 255, 255) when expressed as an 8-bit integer value. Even on a high-dynamic-range device, this brightest value isn't nearly as bright as can occur in the real world. This makes it necessary to map the high-dynamic-range values of the scene to a more limited range for display. Simply scaling the color values down to fit the display range gives an unpleasant, "muddy"-looking image — what is needed is a tone map with a photographic response.

In addition to a high dynamic range, it's also often desirable to use a color space with a wide gamut for rendering. This makes it possible to represent more colors and is particularly important when making content for digital cinema and HDR TV, which have wider gamuts than sRGB and HDTV (Rec. 709).

Color management involves applying the appropriate transforms to convert between color spaces as needed. These transforms are applied at specific points along the creative process:

Image Inputs

The proper way to deal with an input image such as a texture depends on how the image is used in the scene. It also depends on the image itself, including its current color space, its encoding, and its image state (whether its color values are proportional to scene-referred luminance values or display-referred luminance values).

Images used for non-color data should not have any transform applied. This includes bump, normal, and displacement maps, as well as maps used for other attributes such as translucence, specularity, reflectivity, and so on.

For images that represent color values, there are several possibilities:
  • Most high-dynamic-range images are already scene-linear, including OpenEXR, HDR, and some TIFF files. They might not require any tone-scale linearization, but may still require a transform to convert from the primary colors and white point of the input space to those of the rendering space if they are different.
  • Images that have been captured with a particular device should have an input transform applied that is specific for that device. This includes footage from digital cinema cameras, and film plates from ADX-calibrated scanners. Other types of scanned film plates typically require some form of log-to-linear transform.
  • Images that have been prepared for display should have the gamma removed. This includes many common graphics formats including JPEG, PNG, BMP, Targa, and some TIFF files. However it is very important to note that after the gamma has been removed, the color values are linearly proportional to the luminance of the display, not to the luminance of the scene. This is fine for textures since it means that there are no values above 1.0, which is correct for images used for base color, transparency, and other color maps.

Preview

To display a scene-linear image, it must be converted for viewing. This transformation typically has two steps:
  • In the first step, the scene-referred values are converted to a display-referred space. For example, this may involve a tone map to convert colors from a high dynamic range to the 0.0—1.0 range, as well a change of primaries.

  • The second step converts the values for a particular display. This may involve another change of primaries, the appropriate gamma, and encoding as suitable integer values.

Images are usually viewed under lighting conditions that are much dimmer than an outdoor scene or a brightly lit movie set, so tone maps are used to compress high-dynamic-range values into the display range with a photographic response that produces a pleasant image. Tone maps typically apply an S-shaped curve that boosts contrast and saturation to compensate for the lower dynamic range and dimmer viewing conditions. This curve also maps a value of 1.0 in the rendering space to a lower value in order to leave room in the display space for brighter highlights.

Simply applying gamma is not enough to fully prepare a scene-linear image for display. Without a tone map, color values that are above 1.0 remain above 1.0 and get clipped by the monitor.

Rendered Outputs

Whether or not to apply a transform to the rendered output depends on how those files will be used.
  • If the files will be processed further, they should be left in the scene-linear rendering space. This makes the full dynamic range available for operations like compositing and grading. However, the tone map and display transform are still required for viewing these files on a monitor or else they will appear too dark.
  • If the files will be displayed directly (for example, posted on a web page), then the tone map and display encoding should be baked in.
  • In some situations, you may instead need to apply a different transform to convert the files into a specific space.