Straight Alpha vs Premultiplied Alpha

Some people insist premultiplied alpha is the way to go, some say straight alpha. To be frank, both are equal in most situations as long as the math and compositing software’s interpretation of the channels is done correctly. But there are cases only one of the two should be used for best results!

But lets start with an explanation of what premultiplied and straight alpha is:

Premultiplied Alpha

In premultiplied alpha, partly transparent areas of your image, as in anti-aliased edges, a softly feathered edge or a glas object, will be premultiplied with a matting color.

In 9 out of 10 cases, this color will be black, though it is possible to specify the color yourself.

If you are 3D rendering an Image with transparent Pixels, say a glass object, the background colour will be whatever is behind this object.

This means, although you have an alpha channel (RGB[A]) for your image, the RGB channels will be matted (premultiplied) with the (specified) background color.

If the alpha interpretation settings in your software (eg. After Effects, Photoshop) are correct, the amount of matted color will be substracted from your RGB Pixels by using the value in the alpha channel.

Images with premultiplied alpha will look correct, even when the alpha-channel is ignored (or not supported by early-day applications)

Pixel-explanation:

A red pixel that has an alpha of 50% will have the following 8bit  RGBA information: R[127], G[0], B[0], A[127]

An orange pixel that has an alpha of 75% will have the following 8bit RGBA information: R[191], G[95], B[0], A[191]

Straight Alpha

In straight alpha, the RGB channels are left untouched and aren’t matted or premultiplied with a specified colour.

When ignoring the image’s alpha-channel, the image will not look correct and have rough edges and dots all over the place. This can be surprising for people who do not know what straight alpha is.

Today’s Applications should not have any problems anymore to interpret straight alpha correctly.

Pixel-explanation:

A red pixel that has an alpha of 50% will have the following 8bit RGBA information: R[255], G[0], B[0], A[127]

An orange pixel that has an alpha of 75% will have the following 8bit RGBA information: R[255], G[127], B[0], A[191]

Conclusion

First, you should know, what type of Alpha Image you have, because the Image will look different when interpreting it as either Straight or Premultiplied Alpha.

If you have a uniform background colour, both techniques are equal, as long as you tell your compositing software to interpret them correctly.

In After Effects you would want to right-click on your footage and choose “Interpret Footage As” – and then either select “Straight – Unmatted” or “Premultiplied – Matted with colour” and choose your Background Color.

BUT, if you don’t have a uniform solid colour in the background, but say, a complex scene or image behind your transparent object, you will not be able to un-premultiply or un-matte the background colour from a premultiplied alpha image, since this only works with a single colour.

In this case you should use Straight Alpha.

Keep in mind, since there are more calculations involved in using straight alpha, there might be slightly more computational resources needed if you use straight alpha throughout your projects.

Thanks to cgdirector.com for this info. Find the original post here


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *