Home▸Rendering & Computer Graphics▸Alpha Compositing Edge Halos: Premultiplied vs Straight Alpha, Porter-Duff Operators and Gamma-Correct Blending (3D)

Alpha Compositing Edge Halos: Premultiplied vs Straight Alpha, Porter-Duff Operators and Gamma-Correct Blending (3D)

Magnify the antialiased edge of a sprite and see why a dark or bright fringe appears around it. A transparent texel still carries a colour; straight-alpha bilinear filtering mixes it into the edge pixels by t(1-t)(alpha_A - alpha_B)(C_B - C_A), while premultiplied filtering weights every colour by its own alpha and has no halo. Three physical pixel trays on a bench show your pipeline, the reference and the error as raised ridges and trenches, while a monitor shows the whole sprite and the Porter-Duff diagram (over, in, out, atop, xor, plus). Choose the matte colour, filter, sRGB-number or linear-light blending, magnification, edge softness and layer opacity; nineteen numerical checks cover the sRGB curve, the halo closed form, gamma by supersampling, Monte Carlo Porter-Duff coverage and 8-bit premultiplied precision.

Rendering & Computer Graphics3DModerate60 FPS📱 Mobile-adapted🟠 Blender⇄ 2D version
Alpha Compositing Edge Halos: Premultiplied vs Straight Alpha, Porter-Duff Operators and Gamma-Correct Blending (3D) ↗ Open standalone

Magnify the antialiased edge of a sprite and see why a dark or bright fringe appears around it. A transparent texel still carries a colour; straight-alpha bilinear filtering mixes it into the edge pixels by t(1-t)(alpha_A - alpha_B)(C_B - C_A), while premultiplied filtering weights every colour by its own alpha and has no halo. Three physical pixel trays on a bench show your pipeline, the reference and the error as raised ridges and trenches, while a monitor shows the whole sprite and the Porter-Duff diagram (over, in, out, atop, xor, plus). Choose the matte colour, filter, sRGB-number or linear-light blending, magnification, edge softness and layer opacity; nineteen numerical checks cover the sRGB curve, the halo closed form, gamma by supersampling, Monte Carlo Porter-Duff coverage and 8-bit premultiplied precision.

⚙ Under the hood

Magnify the antialiased edge of a sprite and see why a dark or bright fringe appears around it. A transparent texel still carries a colour; straight-alpha bilinear filtering mixes it into the edge pixels by t(1-t)(alpha_A - alpha_B)(C_B - C_A), while premultiplied filtering weights every colour by its own alpha and has no halo. Three physical pixel trays on a bench show your pipeline, the reference and the error as raised ridges and trenches, while a monitor shows the whole sprite and the Porter-Duff diagram (over, in, out, atop, xor, plus). Choose the matte colour, filter, sRGB-number or linear-light blending, magnification, edge softness and layer opacity; nineteen numerical checks cover the sRGB curve, the halo closed form, gamma by supersampling, Monte Carlo Porter-Duff coverage and 8-bit premultiplied precision.

alpha compositingpremultiplied alphaPorter-Dufftexture filteringgamma-correct blendingsRGBedge halocomputer graphics

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)