i
i
i
i
i
i
i
i
140 5. Visual Appearance
Rendering synthetic images meshes naturally with premultiplied alphas.
An antialiased opaque object rendered over a black background provides
premultiplied values by default. Say a white (1, 1, 1) polygon covers 40% of
some pixel along its edge. With (extremely precise) antialiasing, the pixel
value would be set to a gray of 0.4—we would save the color (0.4, 0.4, 0.4)
for this pixel. The alpha value, if stored, would also be 0.4, since this is the
area the polygon covered. The RGBA value would be (0.4, 0.4, 0.4, 0.4),
which is a premultiplied value.
Another way images are stored is with unmultiplied alphas,alsoknown
as unassociated alphas (or even as the mind-bending term nonpremultiplied
alphas). An unmultiplied alpha is just what it says: The RGB value is
not multiplied by the alpha value. This is rarely used in synthetic image
storage, since the final color we see at a pixel is not the shade of the polygon;
it is the shade multiplied by alpha, blended with the background. For
the white polygon example, the unmultiplied color would be (1, 1, 1, 0.4).
This representation has the advantage of storing the polygon’s original
color, but this color would always need to be multiplied by the stored
alpha to be displayed correctly. It is normally best to use premultiplied
whenever filtering and blending is performed, as operations such as linear
interpolation do not work correctly using unmultiplied alphas [67, 104].
For image-manipulation applications, an unassociated alpha is useful to
mask a photograph without affecting the underlying image’s original data.
Image file formats that support alpha include TIFF (both types of alpha)
and PNG (unassociated alpha only) [912].
A concept related to the alpha channel is chroma-keying [143]. This is a
term from video production, in which actors are filmed against a blue, yel-
low, or (increasingly common) green screen and blended with a background.
In the film industry this process is called green-screen or blue-screen mat-
ting. The idea here is that a particular color is designated to be considered
transparent; where it is detected, the background is displayed. This allows
images to be given an outline shape by using just RGB colors—no alpha
needs to be stored. One drawback of this scheme is that the object is either
entirely opaque or transparent at any pixel, i.e., alpha is effectively only
1.0or0.0. As an example, the GIF format allows one color (actually, one
palette entry; see Section 18.1.1) to be designated as transparent.
The over operator can be used for rendering semitransparent objects
on top of whatever has been rendered before, e.g., opaque objects and
more distant transparent objects. This works, in the sense that we perceive
something as transparent whenever the objects behind can be seen through
it [554]. But the over operator is more correctly used to represent some
approximation of how much an opaque object covers a pixel’s cell. A more
representative formula for how a transparent object acts is to represent it
by a combination of filtering and reflection. To filter, the scene behind the