Alpha Blending: Math Behind Color Layering

Tatsuro KAWAMOTO
7 min readApr 16, 2024

If you have dabbled in computer graphics (CG), you might have heard of alpha blending (or alpha compositing), a technique for layering translucent colors.

Although CG is not my area of expertise, let me explain what I have learned recently.

There are various ways to specify colors, such as RGB, CMYK, and HSV. You might have also seen RGBA, which adds the degree of opacity to RGB. The last “A” stands for alpha, and opacity is commonly referred to as “alpha” because traditionally alpha has been used in interpolation formulas [Smith (1995)b].

Opacity is a separate degree of freedom from color specification itself, but unless it’s completely opaque, the colors blend together to create a different color when layered.

Surprisingly, deciding the mixed color is not so simple. One of its challenges is the computational efficiency.

Let’s dive in.

Combinations of the three primary colors of light (left) and the various colors obtained by changing the intensity of each color (right).

First, let me briefly mention that all colors can be obtained by combining the three primary colors of light: red (R), green (G), and blue (B). But there are only three primary colors, i.e., there are only seven combinations possible.

However, there are more than seven colors in the world. By varying the intensity (brightness) of each color, a wide variety of colors can be expressed.

--

--

Tatsuro KAWAMOTO

CEO of Aska Intelligence LLC. Also a Senior Researcher at a National Institute in Japan.