Jim Blinn's Corner

One of the most important anti-aliening tools in computer graphics comes from a generalization of the simple act of storing a pixel into a frame buffer. Several people simultaneously discovered the usefulness of this operation, so it goes by several names: matting, image compositing, alpha blending, overlaying, or lerping. It was most completely codified in a paper by Porter and Duff,’ where they call it the “over” operator. In this column I’m going to show a new way to derive Porter and Duff’s “over” operator and describe some implementation details that I’ve found useful. In a later column 1’11 go into some of the subtleties of how this operator works with integer pixel arithmetic. You can actually use the value of a for a variety of things. In addition to its anti-aliening function, it can represent transparent objects or establish a global fade amount. For this reason, the a value also goes by various names: coverage amount, opacity, or simply alpha. You can also think of it as 1 minus the transparency of the pixel. I’m going to call it opacity for now. If it’s 0, the new pixel is transparent and does not affect the frame buffer. If it’s 1, the new pixel is opaque and completely replaces the current frame buffer color. Next, suppose that we want to layer another object on top of our image. We just blend in the new object’s color, which 1’11 call G, on top of our current background image using its opacity p,