digplanet beta 1: Athena
Share digplanet:

Agriculture

Applied sciences

Arts

Belief

Chronology

Culture

Education

Environment

Geography

Health

History

Humanities

Language

Law

Life

Mathematics

Nature

People

Politics

Science

Society

Technology

This image's alpha channel falls off to zero at its base. A checkered backdrop is often used to signal transparency.

In computer graphics, alpha compositing is the process of combining an image with a background to create the appearance of partial or full transparency. It is often useful to render image elements in separate passes, and then combine the resulting multiple 2D images into a single, final image in a process called the composite. For example, compositing is used extensively when combining computer rendered image elements with live footage.

In order to combine these image elements correctly, it is necessary to keep an associated matte for each element. This matte contains the coverage information—the shape of the geometry being drawn—making it possible to distinguish between parts of the image where the geometry was actually drawn and other parts of the image which are empty.

## Description

To store matte information, the concept of an alpha channel was introduced by Alvy Ray Smith in the late 1970s, and fully developed in a 1984 paper by Thomas Porter and Tom Duff.[1] In a 2D image element, which stores a color for each pixel, additional data is stored in the alpha channel with a value between 0 and 1. A value of 0 means that the pixel does not have any coverage information and is transparent; i.e. there was no color contribution from any geometry because the geometry did not overlap this pixel. A value of 1 means that the pixel is opaque because the geometry completely overlapped the pixel.

If an alpha channel is used in an image, it is common to also multiply the color by the alpha value, to save on additional multiplications during compositing. This is usually referred to as premultiplied alpha.

Assuming that the pixel color is expressed using straight (non-premultiplied) RGBA tuples, a pixel value of (0.0, 0.5, 0.0, 0.5) implies a pixel which has 50% of the maximum green intensity and 50% opacity. If the color were fully green, its RGBA would be (0, 1, 0, 0.5).

However, if this pixel uses premultiplied alpha, all of the RGB values (0, 1, 0) are multiplied by 0.5 and then the alpha is appended to the end to yield (0, 0.5, 0, 0.5). In this case, the 0.5 value for the G channel actually indicates 100% green intensity (with 50% opacity). For this reason, knowing whether a file uses premultiplied or straight alpha is essential to correctly process or composite it.

Premultiplied alpha has some practical advantages over normal alpha blending because premultiplied alpha blending is associative and linear interpolation gives better results, although premultiplication can cause a loss of precision and, in extreme cases, a noticeable loss of quality.

With the existence of an alpha channel, it is possible to express compositing image operations, using a compositing algebra. For example, given two image elements A and B, the most common compositing operation is to combine the images such that A appears in the foreground and B appears in the background. This can be expressed as A over B. In addition to over, Porter and Duff defined the compositing operators in, held out by (usually abbreviated out), atop, and xor (and the reverse operators rover, rin, rout, and ratop) from a consideration of choices in blending the colors of two pixels when their coverage is, conceptually, overlaid orthogonally:

The over operator is, in effect, the normal painting operation (see Painter's algorithm). The in operator is the alpha compositing equivalent of clipping.

As an example, the over operator can be accomplished by applying the following formula to each pixel value:

$C_o = C_a \alpha_a + C_b \alpha_b \left(1 - \alpha_a\right)$

where $C_o$ is the result of the operation, $C_a$ is the color of the pixel in element A, $C_b$ is the color of the pixel in element B, and $\alpha_a$ and $\alpha_b$ are the alpha of the pixels in elements A and B respectively. If it is assumed that all color values are premultiplied by their alpha values ($c_i = \alpha_i C_i$), we can rewrite the equation for output color as:

$C_o = c_a + c_b \left(1 - \alpha_a\right)$

and resulting alpha channel value is

$\alpha_o = \frac{c_o}{C_o} = \alpha_a + \alpha_b \left(1 - \alpha_a\right)$

However, this operation may not be appropriate for all applications, since it is not associative. The associative version of this operation is very similar; simply take the newly computed color value and divide it by its new alpha value, as follows:

$C_o = \frac{1}{\alpha_o}\left[C_a \alpha_a + C_b \alpha_b \left(1 - \alpha_a\right)\right]$

Image editing applications that allow merging of layers generally prefer this second approach.

## Analytical derivation of the over operator

Porter and Duff gave a geometric interpretation of the alpha compositing formula by studying orthogonal coverages. Another derivation of the formula, based on a physical reflectance/transmittance model, can be found in a 1981 paper by Bruce A. Wallace.[2]

A third approach is found by starting out with two very simple assumptions. For simplicity, we shall here use the shorthand notation $a \odot b$ for representing the over operator.

The first assumption is that in the case where the background is opaque (i.e. $\alpha_b = 1$), the over operator represents the convex combination of $a$ and $b$:

$C_o = \alpha_a C_a + (1 - \alpha_a) C_b$

The second assumption is that the operator must respect the associative rule:

$(a \odot b) \odot c = a \odot (b \odot c)$

Now, let us assume that $a$ and $b$ have variable transparencies, whereas $c$ is opaque. We're interested in finding

$o = a \odot b$.

We know from the associative rule that the following must be true:

$o \odot c = a \odot (b \odot c)$

We know that $c$ is opaque and thus follows that $b \odot c$ is opaque, so in the above equation, each $\odot$ operator can be written as a convex combination:

\begin{align} \alpha_o C_o + (1 - \alpha_o) C_c &= \alpha_a C_a + (1 - \alpha_a) (\alpha_b C_b + (1 - \alpha_b) C_c) \\ &= \alpha_a C_a + (1 - \alpha_a) \alpha_b C_b + (1 - \alpha_a) (1 - \alpha_b) C_c \end{align}

Hence we see that this represents an equation of the form $X_0 + Y_0 C_c = X_1 + Y_1 C_c$. By setting $X_0 = X_1$ and $Y_0 = Y_1$ we get

\begin{align} \alpha_o &= 1 - (1 - \alpha_a) (1 - \alpha_b),\\ C_o &= \frac{\alpha_a C_a + (1 - \alpha_a)\alpha_b C_b}{\alpha_o}, \end{align}

which means that we have analytically derived a formula for the output alpha and the output color of $a \odot b$.

An even more compact representation is given by noticing that $(1 - \alpha_a)\alpha_b = \alpha_o - \alpha_a$:

$C_o = \frac{\alpha_a}{\alpha_o} C_a + \left(1 - \frac{\alpha_a}{\alpha_o}\right) C_b$

It is also interesting to note that the $\odot$ operator fulfills all the requirements of a non-commutative monoid, where the identity element $e$ is chosen such that $e \odot a = a \odot e = a$ (i.e. the identity element can be any tuple $\langle C,\alpha\rangle$ with $\alpha = 0$.)

## Alpha blending

Alpha blending is the process of combining a translucent foreground color with a background color, thereby producing a new blended color. The degree of the foreground color's translucency may range from completely transparent to completely opaque. If the foreground color is completely transparent, the blended color will be the background color. Conversely, if it is completely opaque, the blended color will be the foreground color. Of course, the translucency can range between these extremes, in which case the blended color is computed as a weighted average of the foreground and background colors.

Alpha blending is a convex combination of two colors allowing for transparency effects in computer graphics. The value of alpha in the color code ranges from 0.0 to 1.0, where 0.0 represents a fully transparent color, and 1.0 represents a fully opaque color. This alpha value also corresponds to the ratio of "SRC over DST" in Porter and Duff equations.

The value of the resulting color is given by:

$\left\{ \begin{array}{l} out_A = src_A + dst_A (1 - src_A) \\ out_{RGB} = \bigl( src_{RGB} src_A + dst_{RGB} dst_A \left( 1 - src_A \right) \bigr) \div out_A \\ out_A = 0 \Rightarrow out_{RGB} = 0 \end{array} \right.$

If the destination background is opaque, then $dst_A = 1$, and if you enter it to the upper equation:

$\left\{ \begin{array}{l} out_A = 1 \\ out_{RGB} = src_{RGB} src_A + dst_{RGB} (1 - src_A) \end{array} \right.$

The alpha component may be used to blend to red, green and blue components equally, as in 32-bit RGBA, or, alternatively, there may be three alpha values specified corresponding to each of the primary colors for spectral color filtering.

Note that the RGB color may be premultiplied, hence saving the additional multiplication before RGB in the equation above. This can be a considerable saving in processing time given that images are often made up of millions of pixels.

## Other transparency methods

Although used for similar purposes, transparent colors and image masks do not permit the smooth blending of the superimposed image pixels with those of the background (only whole image pixels or whole background pixels allowed).

A similar effect can be achieved with a 1-bit alpha channel, as found in the 16-bit RGBA Highcolor mode of the Truevision TGA image file format and related TARGA and AT-Vista/NU-Vista display adapters' Highcolor graphic mode. This mode devotes 5 bits for every primary RGB color (15-bit RGB) plus a remaining bit as the "alpha channel".

## Applications

Alpha blending is used in a variety of applications. It is natively supported by most operating systems/GUIs for drawing windows (where applicable) or widgets:

Other software may use alpha blended transparent elements in the GUI independently of OS provided APIs by precomposing elements in an off-screen memory buffer before displaying them. (Such as when displaying partially transparent composited elements in an embedded system which provides only a simple frame buffer.) Compositing software is used to combine images, and makes extensive use of alpha compositing techniques.

## References

1. ^ Porter, Thomas; Tom Duff (1984). "Compositing Digital Images". Computer Graphics 18 (3): 253–259. doi:10.1145/800031.808606. ISBN 0-89791-138-5.
2. ^ Wallace, Bruce (1981). "Merging and transformation of raster images for cartoon animation". SIGGRAPH Computer Graphics 15 (3): 253–262. doi:10.1145/800224.806813. ISBN 0-89791-045-1.
 24013 videos foundNext >
 Blender 2.63 Compositor-Alpha channel replacement (for roto-ing video features)http://www.cgdudes.com Here in this tutorial we continue the extraction of the masked Roadway and we present some methods of compositng alpha channel in orde... spaceship1 - compositing color and alpha partsRendering a still image in Anim8or, an image of a spaceship and rendering both an alpha channel for masking and color channel for the colors, then compositin... Compositing in Blender 3D 2.6: animazioni con canale Alpha + Alpha Over (con sottotitoli)Link alla VERSIONE TESTUALE e altre risorse utili (videocorsi, ebook): http://www.redbaron85.com/tutorials/282-tutorials-blender-3d-26-in-italiano/1903-tutor... Alpha - Part 10 - Layer Compositing With ConnectFXLevel: Intermediate Recorded in: Autodesk Smoke 2013 Part 10 - Get alphas out of ConnectFX and back into the sequence for layer compositing. Examine the work... 2D compositing in vegas with a 32 bit alpha channel image with PhotoShop tiphow to work the time line, the books never show this. note: my favorite vegas layout, used at 1920 x 1080 or 1366 x 768 . I never need a really long time lin... Duff-Porter Alpha-Compositing Operatorshttp://demonstrations.wolfram.com/DuffPorterAlphaCompositingOperators/ The Wolfram Demonstrations Project contains thousands of free interactive visualizatio... 04.01. Compositing with Alpha Channels [EDIUS 4]A demonstration of how you can create video clips with alpha channels, with the inbuilt Alphamatte generator.. A tutorial from the series of 'getting-started... 3d max compositing tutorials - course 006 - Alpha passThis is an exclusive tutorial for http://www.grook.net/ For discussions :- Byee. After Effects Tutorial: Advanced Chroma Keying and Compositing (PART 1)Some things covered: -keying out footage -rendering alpha channel -lightwrap technique - Lightwrap Technique: http://maltaannon.com/articles/after-effects/ce... Alpha Channelshttp://library.creativecow.net/harrington_richard/photoshop_alpha_channels In the Photoshop tutorial, Richard Harrington takes a look at making an alpha chan...
 24013 videos foundNext >

We're sorry, but there's no news about "Alpha compositing" right now.

 Limit to books that you can completely read online Include partial books (book previews) .gsc-branding { display:block; }

Oops, we seem to be having trouble contacting Twitter