# Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Alpha merged, Maths, and tricks

• # Alpha merged, Maths, and tricks

2 Members · 4 Posts
• ### DeathWolf

July 10, 2005 at 2:30 pm

Hello all,

I’ve been trying to get afx to realize an idea i had a few days ago
basically, if you think about it, if you have 2 images linearly alpha mixed
and that you know one of the original images, you can find out the 2nd image(with a precision loss, since you miss some of the info(1channel+1/2channel < 2 channels). Mathematically it goes like that if x(i) is the original pic, and x'(i) the new pic and y(i) was the alpha merged pic with alpha=c then x'(i)=c*x(i)+(1-c)*y(i) and by consequence, y(i)=(x'(i)-c*x(i))*1/(1-c) All of this is pretty simple... now the thing is how to do it properly in afx.... the biggest problem is the - function, since afx only has(but maybe i missed something) an absolute difference operator(the difference mode)... As for multiplications, they can be handled by the contrast operator. Of course you get tons of clipping problems everywhere, and ideally one would need to do all calculations in a single function with more precision.... So far i've been getting result that look okay, but with really funky processes and lots of lost info... So, if someone has an idea, please let me know, thanks, Paul-Kenji Cahier

• ### Chris Smith

July 10, 2005 at 5:48 pm

The math is easy, but I’m having a hard time understanding which is which. Technically speaking what are you defining “alpha merged pic” as? Meaning you multiplied the alpha with the RGB channels of itself? Are you saying you multiplied the alpha of two different pictures?

Result pic = PicA multiplied with (which alpha?) plus PicB multiplied with the reverse of (Which alpha?)

Is that what you mean by the -1 being reverse? Or are you just trying to darken the image by a value of 1?

Chris Smith
https://www.sugarfilmproduction.com

• ### DeathWolf

July 10, 2005 at 6:34 pm

well basically it’s just an alpha overlay in “normal mode”
pic1(opacity=1.00(or 100%))+pic2(opacity=c, on top of pic1)=pic3(opacity=100)

the values of pixel on pic3 are calculated through an average since it’s linear
so pic3’s pixels value are as in the formula i gave(unless i’m hallucinating)

• ### DeathWolf

July 11, 2005 at 2:58 am

in case anyone wants to know
i found out a rather good way of doing it