Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I was studying terminology for computer graphics, and this statement came up that confused me.

The image can have alpha channels for transparency.

I tried searching for the meaning of the term "alpha channel," but I got really confused by the definition which used another concept called a "channel." I'm not really sure what this means, so could someone be kind enough to please explain this term to me?

share|improve this question

7 Answers 7

up vote 33 down vote accepted

Digital colors can be made up of three components: red, green, and blue. Combine these together, and you get final color, eg. yellow is 100% red, 100% green and 0% blue.

The fourth component is, as you mentioned, transparency. Together, these form the tuple RGBA (red, green, blue, alpha) which represent an image.

Now, instead of pixels, think about it another way: what if you split up the image into four layers? You could separate them like this:

  • All the red pixels on one layer
  • All the green pixels on one layer
  • All the blue pixels on one layer
  • A value indicating transparency on one layer

These layers are actually called "channels." Here's what they look like in a sample image:

enter image description here

In this image, you can see only the red pixels on the red channel; likewise for green and blue. That's all it means - a way of thinking about images as "channels" of separate colours which are combined together.

share|improve this answer
3  
Great answer, and thanks for the information. I love how you used images to explain the concept. –  Stync Jul 17 at 17:15
1  
You might also want to mention other color systems, because the additive one is not the only one used –  jco Jul 17 at 18:27
4  
Shouldn't those per-channel images have values from zero-value (black) to full-value (e.g. red) instead of black->red->white (e.g.) as shown? (Something like this: f.cl.ly/items/2Q2C1z2s331f1T1U341G/images.png ) –  Slipp D. Thompson Jul 17 at 20:20
1  
@SlippD.Thompson is right. In RGB, white is made by having each color channel have full intensity, meaning that ashes999's image is a bit loose with the rules. –  Alex Jul 17 at 20:45
3  
I chose this picture because it's illustrative. The OP seems confused about the concept. Explaining the concept more simply seemed more important than finding an exact image. Technically, it should be four grey-scale layers (which is what my initial image was), but that's more confusing. –  ashes999 Jul 17 at 21:02

The term comes from the definition of "channel" that means a specific portion of a frequency spectrum. In this case, the red, green and blue components of a color are often referred to as "channels" (since red, green and blue light are portions of the visible light spectrum).

Since alpha is another component of color in computer graphics (although not one strictly related to visible light like that others), it's also called a channel.

share|improve this answer

Alpha channels were actually invented by George Lucas's company Industrial Light & Magic (actually Alvy Ray Smith did most of the work while working there, who was previously employed by Xerox PARC - who we can thank for almost everything in modern computing!).

Alpha channels, in addition to doing cool effects like transparent window, transparent gradients, and realistic shadows, can be used for sub-pixel operations. In fact, the original use was because computer graphics at the time sucked. In order to overlay a nicely anti-aliased image onto a different background (or the background of a live movie), you end up with blocky edges. That won't do for a movie, and trying to anti-alias the images with the backgrounds takes too much CPU time. So .. the edges of the image are made semi-transparent (the alpha channel). This allows the background to show through at varying densities - mixing the colors of the two images together to anti-alias it. This is used everywhere these days, for example, to draw icons with much smoother edges than the resolution would normally allow - and you don't need to recreate the icon for different backgrounds.

Alpha channels are easily done in hardware. Early movie production machines had a "genlock" bit (which was available on Amiga and some Atari machines as well), which was basically an output pin that switched from computer output to video output. The pin was driven by a "transparency" bit in the output (usually with "hicolor" graphics modes 5:5:5 for RGB and 1 bit for transparency = 16 bits/pixel), which allowed easy overlay of computer generated context over live video without digitizing the video. This was later modified to be an analog output with an 8-bit DAC - so instead of switching between computer and live video, it blended it - removing the nasty blocky edges that the 1-bit technique used. Analog anti-aliasing!

Modern video cards can store multiple layers of information in memory at once and use the alpha layer to mix multiple layers of alpha transparency in hardware. This makes your "sprites" and other objects that need to be anti-aliased look nice. Instead of mixing to a fixed background color, the anti-aliasing uses the alpha-channel to mix on the fly. Of course, you can do all sorts of things with the alpha channel, but I hope this gives you a start. For more history, try wikipedia.

share|improve this answer
    
could you provide any reference/citations to the fact A.C. has been invented by IL&M? –  vaxquis Jul 21 at 0:42
    
There's a good overview by Alvy himself on his blog, here: alvyray.com/awards/AwardsAcademy96.htm . This would suggest that it was invented by Alvy Ray and Ed Catmull while they were at NYIT. Both later founded Pixar. –  mvl Jul 23 at 0:00
    
I forget where I originally read it, but wikipedia mentions it –  Evan Langlois Jul 23 at 6:00

All images have 1 or more "channels" of information. For example, the familiar RGB image type has 3 channels of information: Red, Green, and Blue. That is, every pixel in the image has 3 numbers associated with it (if each number is 8 bits, then that's a 24 bit image).

Alpha can add a 4th channel of information (so a 4th number associated with each pixel, and a 32 bit image). This extra channel can be used for a variety of purposes, but the most common purpose is transparency.

Common file formats with alpha channels are PNG and TGA.

share|improve this answer

In many image format, A pixel is defined as a vector with 4 components. RGB and alpha. In the perspective of whole image, you can select only each component of the pixel, and this provides a series of values. If you want to process only one component, then you can select the comonent of all the pixels of the image, and this is usually called a channel. A collection of one component for all pixels. Then alpha channel means collection of alpha component. Similarily, collection of each RGB components can be called red channel, green channel, and blue channel.

share|improve this answer

None of the other examples explain why it's alpha, though. It's from the expression in Alpha Compositing:

enter image description here

where Ca and Cb are the two input colour values and Co is the output combined colour.

Varying the alpha between 0 and 1 varies the colour between front and back composited images.

(Image processing also has "gamma", but not "beta" as far as I know)

share|improve this answer

A pixel is a collection of components. Traditionally these components are red, green and blue, with each of them taking 8 bits of data.

As it is often advantageous to have memory aligned certain ways, these where sometimes packed into 32 bits of space each. This leaves 8 bits of extra data at the end of each pixel. As this is neither red, nor green, or blue, it needs a name -- and alpha was a relatively meaningless name.

Now, when you have an array of pixels arranged into a rectangle, you get this:

   RGBARGBARGBARGBA
   RGBARGBARGBARGBA
   RGBARGBARGBARGBA
   RGBARGBARGBARGBA

sometimes you want to only talk about one of the colors above, say red:

   R***R***R***R***
   R***R***R***R***
   R***R***R***R***
   R***R***R***R***

this sub selection of only one element of each pixel component is called a "channel" in the image. As the pixels have 4 components, this image has 4 channels.

There are other image formats where there is no alpha channel:

   RGBRGBRGBRGB
   RGBRGBRGBRGB
   RGBRGBRGBRGB
   RGBRGBRGBRGB

and there are formats with different number of bits per pixel component (3,5,8,16,32), and some have non-uniform bits per pixel component.

The channel becomes the "virtual" array of only one pixel component. (I say virtual, because there is a stride between each element, while arrays traditionally do not have such stride)

The RGB portion is not fixed either -- you could have a greyscale image with or without an alpha channel, you can have a CMYK image (Cyan Magenta Yellow blacK, usually in a subtractive color space), you can have an image that has a whole myriad of different color channels created by a specular raytracer or a scientific instrument.

While I have treated pixels as if they are always contiguous, it is also possible to have the channels be split over multiple locations, like this:

    RRRRGGGGBBBBAAAA
    RRRRGGGGBBBBAAAA
    RRRRGGGGBBBBAAAA
    RRRRGGGGBBBBAAAA

or even

    RRRR
    RRRR
    RRRR
    RRRR
    GGGG
    GGGG
    GGGG
    GGGG
    BBBB
    BBBB
    BBBB
    BBBB
    AAAA
    AAAA
    AAAA
    AAAA

or have RGB packed and A stored in a separate buffer.

This is uncommon in live data in games, because modern graphics cards are often designed around RGBA pixels. RGB can be handled uniformly, and with A adjacent quick calculations can be done that allow compositing of a RGBA pixel on top of a pre-painted background.

The alpha channel is often used for transparency information. Annoyingly, the max value of alpha is sometimes treated as transparent, and sometimes as opaque, by different code bases. This again is less common nowadays. Alpha channel has also been used for z-buffer ordering (how far the pixel is from the viewer) to allow unordered drawing to a scene, and traditionally mip mapping was done by shoving the 2x 2x (or 4x fewer pixels) lower resolution image into the alpha channel of the higher resolution image, recursively.

Even in a system that uses RGBA pixels, the meaning of these pixels can disagree. Does R measure the how much red a human sees, or how many photons of red should be emitted? This is the difference between linear and non-linear color spaces, and it impacts the correct way to composite said pixels with a transparency channel.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.