Aller au contenu

Auto Gain Node

By Kriss Norde

Auto Gain automatically adjusts the tonal range of an image: the darkest pixels become black, the brightest become white, and the midtones are spread out evenly. Useful to compensate for uneven lighting, boost a low-contrast shot, or view a float/Z-depth image.

Overview

Auto Gain is an automatic normalizer: it detects the minimum and maximum values of the image, then remaps them to the configured black and white. The equivalent of "Auto Levels" in Photoshop / DaVinci Resolve.

It works well as a first diagnosis on a flat shot, but often gives unstable results in animation (the black/white point changes on every frame depending on the detected values - a risk of flicker).

Where to find this node

  • Effects Library: Tools > Color > Auto Gain
  • Quick add: right-click in the Node Editor → Add Tool > Color > Auto Gain

Inputs

  • Input (orange) - required. The 2D image to normalize.
  • Effect Mask (blue) - optional. Limits the normalization to an area.

Setup

MediaIn → Auto Gain → Merge 2D → Saver

Place it at the start of the chain, right after the MediaIn/Loader. Fine adjustments (Color Corrector, Color Curves) come afterward.

Controls tab

Do Z (default: off)
Applies the normalization to the Z-depth channel instead of the RGB channels. Useful to match the ranges of a 3D Z pass across several shots, or to view a float Z in grayscale.
Range
Sets the output black point and white point. By default, 0 and 1 (pure black and pure white). Adjust it for a softer normalization (e.g. 0.05 to 0.95 to keep a little headroom in the extremes).

The Do Z option

A Z-depth pass from a 3D renderer can have values in very different ranges (0 to 1000, or infinite values on the skybox). Visually, these images look completely white or black in a standard viewer.

Turning on Do Z shifts these values into [0, 1] based on the detected min/max, making the Z channel visually readable. Handy to:

  • Debug a Z pass by seeing the depth gradients
  • Match two Z passes across shots for consistent compositing
  • Use Z as a mask (normalized to [0,1], it can drive a Vari Blur or a Merge 2D as a mask)

Use cases

  • Quick compensation for flat lighting - an underexposed or overexposed shot gets its dynamic range back in one click.
  • Viewing a float EXR image - a linear render with values above 1 looks white everywhere. Auto Gain brings it back into a viewable range.
  • Debugging a Z-depth channel - turn on Do Z to see the scene depth in grayscale.
  • A first pass on a vintage / low-contrast shot - gives you a sound base for fine grading with Color Corrector.
  • Normalization before extracting a mask - on an image you need to key, normalizing the contrast can help the keyer.

Tips & limits

  • Flicker in animation - a classic pitfall. On a sequence, the min/max of each frame varies → the black/white point changes on every image, producing brightness flicker. For a sequence, prefer a Color Corrector set manually with fixed values.
  • Alternative: the viewer's "View Normalized Image" - to just view a float image without changing the flow, turn on the viewer's "View Normalized" option (right-click in the viewer → View Options). Cleaner than adding an Auto Gain if you only need to see it.
  • Not ideal for fine grading - Auto Gain is aggressive. After using it, you lose the subtle details in the extremes. Avoid it in the final render, except for a deliberate ultra-contrasty look.
  • An irreversible effect - the "remapped" pixels are overwritten. For a reversible adjustment, prefer Brightness Contrast, which has a Forward/Reverse mode.
  • For a softer normalization, set Range to [0.1, 0.9] rather than [0, 1] - it avoids clipping the extremes.