6
$\begingroup$

I would like to know in blender (internal) if premultiplied alpha is the same effect of "alpha clipping" in the alpha blend mode?

I have found this :

"PREMULTIPLICATED ALPHA

The transparency information is stored in the alpha channel and also in the visible RGB channels, which are multiplied with a background color. The colors of semitransparent areas, such as smoothed edges, are tinted in the background color in proportion to their degree of transparency.

If white pixels have a value of 1 (figure) and black pixels a value of 0 (transparent background) and multiply them by the pixels of the RGB image, pixels multiplied by 1 will maintain their values ​​while pixels multiplied by 0 , Will become black. The problem comes when it is a value between 0 and 1, that is, a grayscale.

When composing these types of images on another background is when problems often occur. These are evidenced in the contours where, due to antialiasing or other effects, some of the pixels are gray, thus they are semitransparent. When composing our images, that semitransparency will show the black pixels of the background. When in addition, the alpha image contains motion blur, the problem is usually much worse, since it increases the number of pixels affected by the premultiplication."

that is a theory ,but I would like to inherence in blender.

$\endgroup$
  • $\begingroup$ While I think I understood your question, would you mind clarifying it a little for future viewers and also to make sure we are on the same page? $\endgroup$ – VRM Nov 24 '16 at 2:54
6
$\begingroup$

No, alpha clipping refers to the amount of clipping applied to the alpha channel in the viewport (that is, what gets transparent and what gets solid in a face with an RGBA texture).

"Premultiplied alpha" refers to one of the two possible alpha modes:

  • Associated or Premultiplied

  • Unassociated or "straight" in Blender.

These alpha "modes" define which alpha over formula has to be used for blending the plate over a background.

When alpha is "associated", the alpha-over operation will simply add the foreground plate to the background previously scaled by the foreground's inverted alpha.

When alpha is "unassociated" (straight), the foreground has to be pre multiplied by its alpha channel before the aforementioned operation, because the pixels with alpha 0 have RGB information that otherwise would be added to the background (and in the case of an unassociated alpha, it's not desired).

The term "pre multiplied" refers in the first case to the fact that the foreground doesn't have to be multiplied by alpha by the over operation, so it's considered as if it was already "pre multiplied".

For that reason, it's adivisable to avoid the term "pre multiplied" becuase it suggests that there was a multiplication (which actually didn't happen). Alpha is "associated" as if it was already "pre multiplied".

Associated alpha allows more nuanced compositing effects than unassociated, as it allows to composite pixels that are both transparent and luminous, therefore is usually the recommended format for VFX (and it's the format that renderers like Blender's internal and cycles produce).

$\endgroup$
  • $\begingroup$ It is used in the compositor however, so it is relevant $\endgroup$ – VRM Nov 24 '16 at 3:53
  • 1
    $\begingroup$ @NᴏᴠɪᴄᴇIɴDɪsɢᴜɪsᴇ Where is alpha clipping used in the compositor? $\endgroup$ – Gez Nov 24 '16 at 4:09
  • $\begingroup$ I was referring to pre-multiplied and straight alpha $\endgroup$ – VRM Nov 24 '16 at 13:50
  • 2
    $\begingroup$ @NᴏᴠɪᴄᴇIɴDɪsɢᴜɪsᴇ Associated alpha is used in the compositor by default because it is the only alpha model that models a plausible physical domain via emission and occlusion. For this reason, it is the only alpha that raytracing rendering engines can generate. The sole reason to ever unassociate is for colour operations. $\endgroup$ – troy_s Nov 24 '16 at 15:20
  • $\begingroup$ I don't quite understand why that means the compositor doesn't/can't use it. Things must be mislabeled quite badly if you are right $\endgroup$ – VRM Nov 24 '16 at 15:34
1
$\begingroup$

Short Answer:

Pre-multiplied alpha refers to the mothod of multiplying the color channels by the alpha value to more accurately represent the resulting color.


Long Answer:

For reference, pre-multiply is defined as:

to multiply (a vector, matrix, or element of a group) noncommutatively by a preceding factor.

The main differences between Pre-multiplied and Straight alpha is as follows:

With straight (unassociated) alpha, the RGB components represent the color of the object or pixel, disregarding its opacity.

Basically, the Alpha and different color channels are completely seperate and do not influence the values of other.

With premultiplied (associated) alpha [...] the RGB components represent the color of the object or pixel, adjusted for its opacity by multiplication.

With this method, the color is adjusted by being multiplied by the Alpha value to make the colors more accurate. This is useful for mixing different colors:

Ordinary interpolation without premultiplied alpha leads to RGB information leaking out of fully transparent (A=0) regions, even though this RGB information is ideally invisible. When interpolating or filtering images with abrupt borders between transparent and opaque regions, this can result in borders of colors that were not visible in the original image. Errors also occur in areas of semitransparancy because the RGB components are not correctly weighted, giving incorrectly high weighting to the color of the more transparent (lower alpha) pixels.

Read further here.


More information:

Straight vs Premultiplied : Understanding Alpha Channels - https://vimeo.com/11064139

http://www.cgdirector.com/quick-tip-straight-alpha-vs-premultiplied-alpha/

https://developer.nvidia.com/content/alpha-blending-pre-or-not-pre

$\endgroup$
  • $\begingroup$ The principles of Alpha blending remain the same regardless of application, so I would recommend researching in a broader scope than Blender if you have any other issues. $\endgroup$ – VRM Nov 24 '16 at 2:53
  • $\begingroup$ which method can I handle in blender? $\endgroup$ – Reifus Rufus Nov 24 '16 at 21:56
  • 2
    $\begingroup$ Although alpha association has impact on the colour of AA pixels after blending, suggesting that is going to make colours more accurate can be misleading and confusing. $\endgroup$ – Gez Nov 25 '16 at 13:32
  • $\begingroup$ Basically it is modifying the color channels themselves, so alpha bleed-through due to a poorly anti-aliased Alpha pass is not as catastrophic $\endgroup$ – VRM Nov 25 '16 at 14:10
  • 1
    $\begingroup$ How AA pixels are modified by alpha channel is only a side effect of having antialiasing. If it's done properly there shouldn't be any bleeds, regardless of alpha association. Alpha association is NOT a method to mitigate poor antialiasing. It's basically a mode intended for compositing (associated, because of its flexibility and the ability to express emission and occlusion), and other for colour operations (unassociated, because you need clean solid pixels to work with, with alpha completely detached) $\endgroup$ – Gez Nov 25 '16 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.