ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# The math behind blending modes

FAQ   •   VIEW ALL
 The math behind blending modes on Feb 21, 2013 at 10:38:01 pm

So I have been trying to figure out exactly what's going on when changing the blending modes between layers. To do this, I am looking at the RGBA data (set to Decimal in 32bpc) in the Info window while moving my mouse about the canvas.

So far, my theories were correct as to how "Multiply" and "Add" get their name... but I came across a much more fundamental question. Rather mindblowing in its simplicity.

How is AE calculating the opacities of two overlapped images?

The example I have been working with is simple: two solids with Opacity=50% overlap to create an overall opacity of 75% (.75 floating point).
I am not understanding the equation of .5 + .5 = .75
Furthermore, it seems .3 + .3 = .51, .75 + .75 = .9375 etc etc.

I'm just curious what the math is behind this calculation.

-Chris

 Re: The math behind blending modeson Feb 21, 2013 at 10:47:42 pm

You might want to ask that question here:

I recall Adobe putting out the precise kind of information you seek, but it was some years ago. Lord only knows where it went.

As I looked at the intimidating document, I thought to myself, "Um, I think it's going to better in the long run if I just play with the blend modes to see what happens."

Dave LaRonde
Former Sr. Promotion Producer
KCRG-TV (ABC) Cedar Rapids, IA

 Re: The math behind blending modeson Feb 21, 2013 at 11:44:48 pm

Chris

I am not understanding the equation of .5 + .5 = .75

This is related to Zeno's Paradox. You can read about it from here:

A lead developer on the After Effects team once described the program's opacity calculations as follows: Imagine you have a light which is 1, and place a 50% transparent filter (say, a sheet of vellum) in front of it. Half the total light is permitted through the vellum (0.5 * 1 = 0.5). Put another 50% transparent sheet of vellum on top of that. Now half of half the light shows through (0.5 * 0.5 = 0.25). You can theoretically repeat ad infinitum without reaching 0% light transmission, at least in a pure digital environment.

Vishesh Arora
3D and Motion Graphics Artist
Films Rajendra

Blog:
http://digieffects.wordpress.com

2011 3D Demo Reel:

 Re: The math behind blending modeson Feb 22, 2013 at 12:04:48 am

In the various blending modes, there are different mathematical AND Boolean operations taking place. Unless you have an extremely good grasp of their potential results -- and a good virtual eye -- they don't explain a whole lot.

Dave LaRonde
Former Sr. Promotion Producer
KCRG-TV (ABC) Cedar Rapids, IA

 Re: The math behind blending modeson Feb 22, 2013 at 12:51:18 am

See my answer to your question here:

---------------------------------------------------------------------------------------------------------
Todd Kopriva, Adobe Systems Incorporated
After Effects quality engineering
After Effects team blog
---------------------------------------------------------------------------------------------------------

 Re: The math behind blending modeson Feb 22, 2013 at 1:43:40 am

Definitely needed to take a step back and think that through logically. Thanks for the help, everyone!

-Chris

 Re: The math behind blending modeson Feb 23, 2013 at 1:19:11 am

The Normal blend mode is a standard alpha blend. The reason the colors don't quite make sense in a simple mathematical relationship is because you're not considering the alpha values.

If you assume 'A' is the top layer, 'B' is the lower layer and their alphas are 'a' and 'b' respectively then the resulting color is:

A*a + B*b*(1-a)

Opacity modifies the alpha of the layer.

Darby Edelen