> Just to share another example for the blending mode "Screen",
> whose formula is: f(a,b) = (a+b) - (a*b).
>
>
> which can be further simplified to:
>
> A + B - A*B

And for the true compositing math geeks out there, bonus points for
noting that the screen equation is also the EXACT formula for adding
two independent probabilities.

Given two independents events, A, B, the probably of EITHER A OR B
occurring is the probability of A, plus the probability of B, minus
the probability of both A AND B occurring (which was doubly counted,
venn diagram style). I.E., A+B-AB.

Now realize that an alpha channel can also be sensibly interpreted as
a *probability* from 0 to 1.  (Alphas as probabilities is actually a
cool mental model useful elsewhere too).

So if you have 2 alpha channels representing *independent* objects,
let's call these images A, B.  If you want to know what alpha image
would be the result of the union -  either A or B - the math to use is
the screen operator! :)  This is true independent of bit depth,
working for floats too.

Screen on HDR color channels, of course, is non-sensical.  But screen,
even in float, is the only right way to add alphas for independent*
objects.

*Examples of independent /uncorrelated alphas include renders of
totally different objects.  Examples of correlated alphas would be two
alphas held out by a common foreground element, or a shadow matte vs a
midtone matte, created from the same luma image.

-- Jeremy
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to