All Topics  
Alpha compositing

 
Alpha Compositing

   Email Print
   Bookmark   Link






 

Alpha compositing



 
 
In computer graphics
Computer graphics

Computer graphics are graphics created by computers and, more generally, the representation and manipulation of pictorial data by a computer....
, alpha compositing is the process of combining an image with a background to create the appearance of partial 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 compositing. 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
Matte (filmmaking)

Mattes are used in photography and special effects filmmaking to combine two or more image elements into a single, final image. Usually, mattes are used to combine a foreground image with a background image ....
 for each element.






Discussion
Ask a question about 'Alpha compositing'
Start a new discussion about 'Alpha compositing'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In computer graphics
Computer graphics

Computer graphics are graphics created by computers and, more generally, the representation and manipulation of pictorial data by a computer....
, alpha compositing is the process of combining an image with a background to create the appearance of partial 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 compositing. 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
Matte (filmmaking)

Mattes are used in photography and special effects filmmaking to combine two or more image elements into a single, final image. Usually, mattes are used to combine a foreground image with a background image ....
 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 A. R. Smith
Alvy Ray Smith

Alvy Ray Smith III is an American engineer and noted pioneer in computer graphics....
 in the late 1970s, and fully developed in a 1984 paper by Thomas Porter and Tom Duff
Tom Duff

Thomas Douglas Selkirk Duff is a computer programmer. He was born in Toronto, Ontario, Canada and grew up in Toronto and Leaside, Ontario. In 1974 he graduated from the University of Waterloo with a B.Math and, two years later, got an M.Sc....
. In a 2D image element which stores a color for each pixel, additional data is stored in the alpha channel with a value of 0 or 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. Thus, assuming that the pixel color is expressed using RGB
RGB color space

An RGB color space is any additive color space based on the RGB color model. A particular RGB color space is defined by the three chromaticity of the red, green, and blue additive primaries, and can produce any chromaticity that is the triangle defined by those primary colors....
 triples, a pixel value of (0.0, 0.5, 0.0, 0.5) implies a pixel which is fully green and has 50% coverage. (Explanation: The RGB values are the first three values, (0, 0.5, 0) and the alpha value is the fourth, 0.5. If the color were fully green, its RGB would be (0, 1, 0). Since this pixel is using a premultiplied alpha, all of the RGB values in the ordered triplet (0, 1, 0) are multiplied by 0.5 and then the alpha is added to the end to yield (0, 0.5, 0, 0.5). )

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, 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
Painter's algorithm

The painter's algorithm, also known as a priority fill, is one of the simplest solutions to the visibility problem in 3D computer graphics....
). The in operator is the alpha compositing equivalent of clipping
Clipping (computer graphics)

In rendering , clipping refers to an optimization where the computer only draws things that might be visible to the viewer....
.

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

where is the result of the operation, is the color of the pixel in element A, is the color of the pixel in element B, and and 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 , we can rewrite this as:

where

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:

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

Alpha blending

Alpha blending is a convex combination
Convex combination

A convex combination is a linear combination of point where all coefficients are non-negative and sum up to 1. All possible convex combinations will be within the convex hull of the given points....
 of two color
Color

Color or colour is the visual perception property corresponding in humans to the categories called red, yellow, blue and others....
s allowing for transparency
Transparency (graphic)

Transparency is possible in a number of graphics file formats. The term transparency is used in various ways by different people, but at its simplest there is "full transparency" i.e....
 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.

The value of the resulting color when color Value1 with an alpha value of is drawn over an opaque background of color Value0 is given by:

The alpha component may be used to blend to red
Red

Red is any of a number of similar colors evoked by light consisting predominantly of the longest wavelengths of light discernible by the human eye, in the wavelength range of roughly 625?740 Nanometer....
, green
Green

Green is a color, the perception of which is evoked by light having a spectrum dominated by energy with a wavelength of roughly 520?570-Nanometre....
 and blue
Blue

Blue is a colour, the perception of which is evoked by light having a spectrum dominated by energy with a wavelength of roughly 440?490 Nanometre....
 components equally, as in 32-bit
32-bit

The range of integer values that can be stored in 32 bits is 0 through 4,294,967,295 or -2,147,483,648 through 2,147,483,647 using two's complement encoding....
 RGBA
RGBA color space

RGBA stands for Red Green Blue Alpha. While it is sometimes described as a color space, it is actually simply a use of the RGB color model, with extra information....
, or, alternatively, there may be three alpha values specified corresponding to each of the primary color
Primary color

Primary colors are sets of colors that can be combined to make a useful range of colors. For human applications, three are often used; for additive combination of colors, as in overlapping projected lights or in cathode ray tube displays, the primary colors normally used are red, green, and blue....
s for spectral color
Spectral color

A spectral color is a color that is evoked by a single wavelength of light in the visible spectrum, or by a relatively narrow band of wavelengths....
 filtering
Filter (optics)

Optical filters, generally, belong to one of two categories. The simplest, physically, is the absorptive filter, while the latter category, that of interference or dichroic filters, can be quite complex....
.

Alpha blending is natively supported by these operating systems/GUIs:
  • Mac OS X
    Mac OS X

    Mac OS X is a line of computer operating systems developed, marketed, and sold by Apple Inc., and since 2002 has been included with all new Macintosh computer systems....
  • Windows 2000
    Windows 2000

    Windows 2000 is a line of operating systems produced by Microsoft for use on business desktops, Laptop, and Server . Released on 17 February, 2000, it was the successor to Windows NT 4.0, and is the final release of Microsoft Windows to display the "Windows NT" designation....
    , XP
    Windows XP

    Windows XP is a line of operating systems produced by Microsoft for use on personal computers, including home and business desktops, laptop, and media centers....
    , Server 2003
    Windows Server 2003

    Windows Server 2003 is a Server operating system produced by Microsoft. Introduced on 24 April 2003 as the successor to Windows 2000 Server, it is considered by Microsoft to be the cornerstone of its Windows Server System line of business server products....
    , Windows CE
    Windows CE

    Windows CE is Microsoft's operating system for minimalistic computers and embedded systems. Windows CE is a distinctly different operating system and Kernel , rather than a trimmed-down version of desktop Windows....
    , Vista
    Windows Vista

    Windows Vista is one member in a family of operating systems developed by Microsoft for use on personal computers, including home and business Desktop computer, laptops, Tablet PCs, and media center PCs....
     and Windows 7
  • The XRender
    XRender

    The X Rendering Extension is an X Window System extension to implement Alpha compositing in the X server....
     extension to the X Window System
    X Window System

    The X Window System is a computing software system and network protocol that provides a graphical user interface for networked computers. It implements the X Window System protocols and architecture and provides windowing system on raster graphics Visual display units and manages Keyboard and pointing device control functions....
     (this includes modern Linux
    Linux

    Linux is a generic term referring to Unix-like computer operating systems based on the Linux kernel. Their development is one of the most prominent examples of free and open source software collaboration; typically all the underlying source code can be used, freely modified, and redistributed by anyone under the terms of the GNU GPL license...
     systems)
  • RISC OS Adjust
    RISC OS

    RISC OS is a computer operating system which was originally developed by Acorn Computers Ltd in Cambridge, England for their ARM architecture based computers....
  • QNX
    QNX

    QNX is a commercial Unix-like real-time operating system, aimed primarily at the embedded systems market. On September 12, 2007, the source of the QNX kernel was released for non-commercial use....
     Neutrino
  • Plan 9
    Plan 9 from Bell Labs

    Plan 9 from Bell Labs is a distributed operating system, primarily used for research. It was developed as the research successor to Unix by the Computing Sciences Research Center at Bell Labs between the mid-1980s and 2002....
  • Inferno
  • AmigaOS 4.1
  • BeOS
    BeOS

    BeOS was an operating system for personal computers which began development by Be Inc. in 1991. It was first written to run on BeBox hardware. BeOS was optimized for digital media work and was written to take advantage of modern hardware facilities such as symmetric multiprocessing by utilizing modular I/O bandwidth, pervasive multithreading,...
    , Zeta and Haiku
    Haiku (operating system)

    Haiku, formerly known as OpenBeOS , is a free software and open source software project dedicated to the re-creation and continuation of BeOS on X86 architecture and PowerPC based computers....
  • Syllable
    Syllable (operating system)

    Syllable is a Free software and open-source software operating system for Pentium and compatible processors. Its purpose is to create an easy-to-use desktop operating system for the home and small office user....
  • MorphOS
    MorphOS

    MorphOS is a computer operating system . It is a mixed proprietary software and open source OS produced for the Pegasos PowerPC -processor-based computer, most models of PPC-accelerator-equipped Amiga computers, and a series of Freescale development boards that use the Genesi Firmware, including the EFIKA and mobileGT....


Other transparency methods


Although used for similar purposes, transparent color
Palette (computing)

In computer graphics, a palette is either a given, finite set of colors for the management of digital images , or a small on-screen graphical element for choosing from a limited set of choices, not necessarily colors ....
s and image mask
Mask (computing)

In computer science, a mask is data that is used for bitwise operations.Using a mask, multiple bits in a byte, nibble, word can be set either on, off or inverted from on to off in a single bitwise operation....
s 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 an 1-bit alpha channel, as found in the 16-bit RGBA Highcolor mode of the Truevision TGA
Truevision TGA

Truevision's TGA File Format, often referred to as TARGA File Format, is a raster graphics Graphics file format summary. It was the native format of Truevision's TARGA and VISTA boards, which were the first Graphics processing units for IBM PC compatible to support Highcolor/truecolor display....
 image file format and related TARGA
Targa

Targa is an old word for targe, shield. Targa or TARGA may also refer to:Car rallies*Targa Florio, Sicily, Italy*Targa New Zealand*Targa Newfoundland, Canada...
 and AT-Vista/NU-Vista display adapters' Highcolor graphic mode. This mode devotes 5 bits for every primary RGB color (15-bit RGB
List of monochrome and RGB palettes

This list of monochrome and RGB palettes includes generic repertoires of colors to produce black-and-white and RGB color pictures by a computer's display Computer hardware, not necessarily the total number of such colors that can be simultaneously displayed in a given text or graphic mode of any machine....
) plus a remaining bit as the "alpha channel".

External Links



See also

  • RGBA color space
    RGBA color space

    RGBA stands for Red Green Blue Alpha. While it is sometimes described as a color space, it is actually simply a use of the RGB color model, with extra information....
  • Digital compositing
    Digital compositing

    Digital compositing is the process of digitally assembling multiple images to make a final image, typically for print, film or screen display. It is the evolution into the digital realm of optical film compositing....
  • Transparency (graphic)
    Transparency (graphic)

    Transparency is possible in a number of graphics file formats. The term transparency is used in various ways by different people, but at its simplest there is "full transparency" i.e....
  • Transparent color in palettes
    Palette (computing)

    In computer graphics, a palette is either a given, finite set of colors for the management of digital images , or a small on-screen graphical element for choosing from a limited set of choices, not necessarily colors ....
  • Image masks
    Mask (computing)

    In computer science, a mask is data that is used for bitwise operations.Using a mask, multiple bits in a byte, nibble, word can be set either on, off or inverted from on to off in a single bitwise operation....
  • Portable Network Graphics
  • Truevision TGA
    Truevision TGA

    Truevision's TGA File Format, often referred to as TARGA File Format, is a raster graphics Graphics file format summary. It was the native format of Truevision's TARGA and VISTA boards, which were the first Graphics processing units for IBM PC compatible to support Highcolor/truecolor display....
  • Magic Pink
  • Texture splatting
    Texture Splatting

    In computer graphics, texture splatting is a method for combining different texture . The method works by applying an Transparency to the higher levels, revealing the layers underneath where the alphamap is partially or completely transparent....