Alpha Compositing - Analytical Derivation of The Over Operator

Analytical Derivation of The Over Operator

Porter and Duff gave a geometric interpretation of the alpha compositing formula by studying orthogonal coverages. Another derivation of the formula, based on a physical reflectance/transmittance model, can be found in a 1981 paper by Bruce A. Wallace.

A third approach is found by starting out with two very simple assumptions. For simplicity, we shall here use the shorthand notation for representing the over operator.

The first assumption is that in the case where the background is opaque (i.e. ), the over operator represents the convex combination of and :

The second assumption is that the operator must respect the associative rule:

Now, let us assume that and have variable transparencies, whereas is opaque. We're interested in finding

.

We know from the associative rule that the following must be true:

We know that is opaque and thus follows that is opaque, so in the above equation, each operator can be written as a convex combination:


\begin{align} \alpha_o C_o + (1 - \alpha_o) C_c &= \alpha_a C_a + (1 - \alpha_a) (\alpha_b C_b + (1 - \alpha_b) C_c) \\ &= \alpha_a C_a + (1 - \alpha_a) \alpha_b C_b + (1 - \alpha_a) (1 - \alpha_b) C_c
\end{align}

Hence we see that this represents an equation of the form . By setting and we get


\begin{align} \alpha_o &= 1 - (1 - \alpha_a) (1 - \alpha_b),\\ C_o &= \frac{\alpha_a C_a + (1 - \alpha_a)\alpha_b C_b}{\alpha_o},
\end{align}

which means that we have analytically derived a formula for the output alpha and the output color of .

An even more compact representation is given by noticing that :

 C_o = \frac{\alpha_a}{\alpha_o} C_a + \left(1 - \frac{\alpha_a}{\alpha_o}\right) C_b

It is also interesting to note that the operator fulfills all the requirements of a non-commutative monoid, where the identity element is chosen such that (i.e. the identity element can be any tuple with .)

Read more about this topic:  Alpha Compositing

Famous quotes containing the word analytical:

    I have seen too much not to know that the impression of a woman may be more valuable than the conclusion of an analytical reasoner.
    Sir Arthur Conan Doyle (1859–1930)