Glazing in Floating Point
The first glaze went on too thick. Carmine over a steel grey cloak, supposed to suggest warmth from a nearby fire — but I’d loaded the brush wrong, and the red sat opaque on the surface instead of sinking into the shadows. Stripped it with a wet brush, tried again. Thinner this time. The grey showed through the red, and suddenly the cloak had depth.
This is what Tom Porter and Tom Duff formalised in 1984 at Lucasfilm: the mathematics of layering partially transparent images. Their paper introduced the alpha channel — a fourth value alongside red, green, and blue that describes how much of the underlying colour bleeds through.
The standard formula for compositing colour A over colour B:
result = (A × αA) + (B × αB × (1 - αA))
The source colour contributes in proportion to its opacity. Whatever remains of the destination shows through the transparent portion. Stack enough glazes and you get the illusion of depth — light penetrating multiple layers before bouncing back.
# Alpha compositing: source over destination
composite <- function(src, dst, alpha) {
src * alpha + dst * (1 - alpha)
}
# Glaze carmine (0.8, 0.1, 0.2) over steel grey (0.4, 0.4, 0.45)
carmine <- c(0.8, 0.1, 0.2)
grey <- c(0.4, 0.4, 0.45)
glazed <- composite(carmine, grey, alpha = 0.25)
cat(sprintf("RGB: %.2f, %.2f, %.2f\n", glazed[1], glazed[2], glazed[3]))
RGB: 0.50, 0.33, 0.39
That muted rose-grey is exactly the colour on my cloak right now. The formula predicted it.
program AlphaComposite;
var
srcR, srcG, srcB: Real;
dstR, dstG, dstB: Real;
alpha: Real;
begin
srcR := 0.8; srcG := 0.1; srcB := 0.2; { carmine }
dstR := 0.4; dstG := 0.4; dstB := 0.45; { steel grey }
alpha := 0.25;
WriteLn('R: ', srcR * alpha + dstR * (1 - alpha):0:2);
WriteLn('G: ', srcG * alpha + dstG * (1 - alpha):0:2);
WriteLn('B: ', srcB * alpha + dstB * (1 - alpha):0:2);
end.
Porter and Duff catalogued twelve compositing operators — over, in, out, atop, and others — each useful for different layering situations. Miniature painters discovered most of these empirically: wet blending is plus, edge highlighting is over with high alpha, oil washes are multiply (a different operation entirely, but the intuition transfers).
The painters had the technique centuries before the algebra existed. What the algebra provides is predictability — you can calculate the result of stacking three glazes before committing pigment to plastic. Whether anyone actually does this instead of just loading another thin layer onto the brush is another question. I’ve been at this for six hours. The formula says my shadows should read as depth. My eyes aren’t sure yet.