Graphics Reference
In-Depth Information
Foreground image
Occlusion mask
Background image
over
Output image
for each pixel(i,j)
if(Occlusion[i][j]
0)
Output[i][j]
Foreground[i][j]
else
Output[i][j]
Background[i][j]
FIGURE A.4
Compositing using a one-bit occlusion mask.
operated on two at a time. Each operation replaces the two input images with the output image. Images
can be composited in any order as long as the two composited during any one step are adjacent in their
depth ordering.
Compositing the images using a one-bit occlusion mask, that is, using the color of a foreground
image pixel in the output image, is an all-or-nothing decision. However, if the foreground image is
calculated by considering semitransparent surfaces or partial pixel coverage, then fractional occlu-
sion information must be available and anti-aliasing during the pixel-merging process must be
taken into account. Instead of using a one-bit mask for an all-or-nothing decision, using more bits
allows a partial decision. This gray-scale mask is called alpha and is commonly maintained as a
fourth alpha channel in addition to the three (red, green, and blue) color channels. The alpha chan-
nel is used to hold an opacity factor for each pixel. Even this is a shortcut; to be more accurate, an
alpha channel for each of the three colors R , G ,and B is required. A typical size for the alpha
channel is eight bits.
The fractional occlusion information available in the alpha channel is an approximation used in lieu
of detailed knowledge about the three-dimensional geometry of the two scenes to be combined. Ideally,
 
Search WWH ::




Custom Search