5 Replies Latest reply on Nov 28, 2013 7:39 AM by ScoJay

    The math behind blending modes

    C.Mellor Level 1

      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

        • 1. Re: The math behind blending modes
          Rick Gerard Adobe Community Professional & MVP

          You are over thinking this. It's just simple math. One layer with opacity set to 50% gives you an alpha value of half the range so with float enabled the range is 0 to 1 so the value is .5. That's easy and you get that.

           

          Now add another layer to the mix with the opacity set to 50%. You now have one layer with half opacity BLENDED with another layer of half opacity so the total alpha value would be .5 for the first layer but .25 for the second. Throw in a third and you get .5 + .25 + (you guessed it) 12.5 for a value of .8570   Perfectly logical if you step back about 10 feet and take a look from another angle.

           

          If you want the values to add then you simply change the blend mode to Alpha Add. Now the values add and two layers with an alpha value of .5 give you an alpha value of 1.

           

          Hope this helps...

           

          One more thought. Many times switching the Blend Mode to Alpha Add will help join the edges of 3D layers because it makes more opaque edges where the 3D layers meet by Adding the Alpha Values instead of combining them.

          • 2. Re: The math behind blending modes
            Todd_Kopriva Level 8

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

             

            Take a piece of glass that lets half of the light through. Stack that on top of an identical pane of glass that lets half of the light through.

             

            50% goes through the first one, leaving 50%. Half of that 50% gets through the second pane, meaning that 25% of the original gets through and 75% is blocked.

             

            For in-depth information about the concepts and algorithms behind these blending modes as implemented in several Adobe applications, see section 7.2.4 of version 1.7 of the PDF reference on the Adobe website.

            • 3. Re: The math behind blending modes
              Todd_Kopriva Level 8

              Ah, looks like Rick answered when I was in the middle of answering. Good to get confirmation, though.

              • 4. Re: The math behind blending modes
                C.Mellor Level 1

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

                • 5. Re: The math behind blending modes
                  ScoJay Level 1

                  This is helpful, and I went looking for the math for the algorithms.  I didn't find a section 7.2.4, but I did find that Table 136 under section 11.3.5 had the Blend Modes and the math behind them.  I think this is what you are referring to in your post.

                   

                  Scott