I need to mask different parts of an image and separate them in different pipelines.

The only way i found is by using a Channel booleans by copying original image in the Background RGB and the mask in the Foreground alpha. But it's not enough because i get a semi/transparent result. I need to pipe a Matte Control node and perform a Post multiply image, which i didn't fully understand.

One more thing i need to understand (i'm a newbie and i need to nail some alpha concepts).I understand that i need to post multiply the image with the alpha channel to get my result. What i don't understand is why i get a semi transparent cutout if i uncheck "Post multiply image" instead of a fully opaque result. Is it due to Fusion mixing RGB and alpha in such a way to let me see that there is an alpha or what? I don't get it.

I'll try to explain it a little, but I may make some mistakes in doing so. I'm sure people will correct me.

If you create an alpha channel - in this case by adding a garbage mask in the matte control tool - you only tell Fusion: I want this part of the image to be transparent and this part opaque. This does not yet change the actual colors of the image. So you can have a pixel that's pure white (RGB 255,255,255) with an alpha channel of 0. What post multiply does is ... multiply the RGB values with the alpha channel, resulting in RGB 0,0,0 with alpha 0. This is important because by default Fusion merges additively, which means that if your background is for example 128,128,128 and you merge an image on top of it that's 127,127,127 the end result will be 255,255,255 i.e. full white if you use an alpha of 0.It's a bit more complicated than this, but the bottom line is that the post multiplication makes sure that the merges work correctly. By default in the matte control the 'multiply garbage matte' is checked, so there's nothing more you need to do.

In my composition there is no merge yet. Well, there is a merge between two shapes but checking the result i get an alpha = 1 where i see white and alpha = 0 where i see black (picture 2).What puzzles me is that the default behavior of the "Matte Control" tool gives me (picture 3) which i don't really understand.By selecting "Post multiply image" i get (picture 4), which is the desired result. I don't get why the background looks like it has an alpha of 0.5 in (picture 3).

It's difficult to see on your picture, since it's very small, but it's most likely because you put a merge between the shapes. Don't do that. There is no need for it. Masks are special tools, that are not actually images as far as Fusion is concerned. You can just put one shape after the other and do the merging/subtracting/adding etc right in the mask tools. Also: make sure that the shapes go into the 'garbage matte' input of the matte control. If you do this, there is no need to post multiply the image.

Sander, your description of post-multiplication (pre-multiplication in the Other Compositors) is pretty good, but I think you're going to confuse yourself and others by using integer 0-255 values instead of normalized 0-1 values.

For instance, if you multiply 128 * 128, your math education suggests you should get 16,384, right? But instead you get 64. What gives? In fact, the imaging software is always doing its math in normalized 0-1 values, so what you're actually doing is 0.5 * 0.5 = 0.25. (0.25 * 255 = 64.75) That's why the image gets darker when you multiply instead of brighter.

Train yourself to think in these normalized terms, and you'll have a much easier time understanding and communicating the image processing math.

--

Now, Umberto, the reason your image looks translucent in picture three is exactly as Sander said: The RGB pixels still have their original values, but since the Alpha is 0, they get added to whatever's in the background. In this case, the checkerboard pattern of the canvas. If you were to turn off Show Checker Underlay in the viewer, then picture 3 would look exactly like picture 1 because it would be adding the 0 of the black canvas to those pixels instead of greys and whites.

Sometimes that might be exactly what you want to happen. If you need to composite a light source into an image, it's common to do it by setting the alpha to 0 without post-multiplying. When you then perform an additive Merge, the light is simply added instead to the background instead of having its alpha channel carved out of the background first.

Another way to get the result you were after is to set the ChannelBooleans node to Clear and put your matte in the Mask input. Or if you wanted to do it really explicitly, you could set the ChannelBooleans up to Multiply or And (they're functionally the same operation) the image by the matte, which you would have to put into the Foreground input.

Sander, your description of post-multiplication (pre-multiplication in the Other Compositors) is pretty good, but I think you're going to confuse yourself and others by using integer 0-255 values instead of normalized 0-1 values.

And then you get into the Alpha Gain slider, which is a multiplier on the AlphaFG, and the Blend control, which is a multiplier on the entire FG portion of the equation. I haven't yet worked out what Burn In does.

Guess that the Alpha should stay also somewhere in the S part of the expression, anyway i got the overall idea. And i understand that the merge node gives so much freedom over the standard additive/subtractive technique. Sure this will help in certain situation. The most important thing for me now is having understood which is which.

I'm happy i did cross this "happy accident", this let me nail some concepts that otherwise would stay in my "romantic ideas" room. And alpha channel was one of those ideas