Entry 22 · Passes
The alpha problem
Premultiplied or not, and the halo that tells you which.
- Entry
- 22
- Section
- 05 Passes
- By
- Tom Beddoe
- Read
- 2 min
The halo you should never see
Composite a rendered object over a new background and a pale fringe sometimes appears at the edge — a ghostly echo of the original plate colour clinging to the silhouette. That fringe is not a compositing error. It is the correct symptom of a mismatch between how the renderer wrote the alpha and how the compositor read it.
The problem lives in two competing conventions. In a premultiplied image, the RGB channels have already been multiplied by the alpha: a pixel that is fifty percent transparent carries half its colour value in the RGB data. In an unpremultiplied (sometimes called straight) image, the RGB channels hold the full surface colour regardless of coverage, and the alpha is stored separately as a pure mask. Both conventions are lossless in principle, but they are not interchangeable, and treating one as the other is where the fringe comes from.
Compositing mathematics is built for premultiplied data. The over operation — A over B — assumes the foreground's colour has already been weighted by its alpha. Feed it a straight image without converting first and the edges get double-counted: the compositor does not multiply the foreground by alpha, because it assumes that has already happened, so the full unattenuated colour is added on top of the background. The result is a sharp, slightly bright halo, wider on semi-transparent areas like motion-blurred edges, hair or frosted glass.
Most renderers write premultiplied EXR by default, and most compositing applications read EXR expecting premultiplied data. The system is consistent until a file passes through a tool — a paint package, a media encoder, a web browser — that assumes straight alpha, strips the premultiplication, and re-saves. That saved file looks identical in isolation. The halo only reveals itself when the file lands back in the composite.
The diagnostic is simple: pull the image over a strong solid — pure red or pure green — and zoom into the edge. A clean premultiplied extraction over the new background shows no fringe. A straight image treated as premultiplied shows the old background colour bleeding outward. A premultiplied image treated as straight shows the edge darkening and going transparent too early.
Knowing which convention a file uses is not a matter of style. It is a matter of reading the file's own metadata — and, when that is absent or wrong, running the diagnostic before the halo reaches a client.
More in Passes
Every entry in this section is listed on the Passes page, and all twenty-four sit in the full register.