Top 5 Blending Operations used in my composting process and how they work:

Normal (Over)
This is the most common blending operation. A covers B except where it is transparent. (A+(B*(1-alpha)) = C)
This of course assumes that the alpha has been premultiplied. We can write the same formula differently where you can process one color channel at a time. (A*a)+((B*b)*(1-a))=C)

Stencil
This operation is similar to the Normal function where it uses A to cutout a spot in B (B*(1-a) = C) If the alpha is some other value than 1 or 0, it gets multiplied.

Add (plus)
This is most arguably the second most used operation. (A+B=C)
This gets used in places such as adding specular or reflection highlights. However, it should only be used when working in floating point values because the final pixel can exceed the normalized 1.0 threshold and create superwhites. If this operation is used in an 8 bit image, it can often get over-exposed and washed out, which is not desirable at all. To fix this there is another function called Screen.

Screen
Screen offers a solution to working in LDR images. The math is as follows ((A+B)-(A*B)=C It does not allow a pixel value to exceed 1

Multiply
Straight forward enough. (A*B) Multiply uses a conditional that tests for negative numbers and coverts them into zeroes which prevents C from becoming a negative value. It is most often used to composite dark elements against lighter backgrounds. Multiplying is often overused in compositing and can often lead to degradation of the final output. It best serves in the texturing phase.

Friday, July 9th, 2010 Uncategorized

Leave a Reply