Saturday, May 27, 2017

adobe illustrator - Combining transparency


A 50% opaque white object put on top of another 50% opaque white object is not anywhere near as white as a 100% opaque white object (blending mode normal). I tried this in Illustrator and Inkscape, and the results seem to be similar, so my question is: how are overlapping transparencies calculated? Is there a way to force either to use simple addition (30% opaque on top of 20% opaque = 50% opaque)?



Answer



Let the 2 otherwise identical layers have opacities 80% and 40%.


Represent the opacities as decimal numbers ie. 0,8 for 80% and 0,4 for 40%


The combined opacity as decimal number is 1 - (1-0,8)*(1- 0,4) = 1 - 0,2 * 0,6 = 1 - 0,12 = 0,88


As percentage that is 88%


The general formula for combining opacities A and B as decimal numbers:


Opacity = 1 - (1 -A)*(1 - B)



This is easy, if one thinks 1-A and 1-B as "transparencies". The combined transparency is calculated by multiplying the single layer transparencies. The opacity is = 1 - the transparency.


Your example: A=0,3 and B=0,2. The transparencies are 0,7 and 0,8


The combined opacity is 1 - 0,7 * 0,8 = 1 - 0,56 = 0,44 = 44%


ADDENDUM: The questioner wanted a way to force the combined opacity to be the sum of single layer opacities. This unfortunately is impossible. Let the layer opacities be 60% and 70%. We have no way to make something to have 130% opacity. 100% is the maximum. Nothing can be less transparent than the absolutely non-transparent.


If one has the single layer opacity = A (decimal) and wants to pile these layers to get the combined opacity = C, he needs log(1-C)/log(1-A) layers.


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...