@fred said:
@mark have you ever encountered or thought about this? It does not seem there is a logical way around this, but it is a case by case issue.
@artoo @Kathmandale @woland
As Fred has pointed out, considering how one might make use of the alpha channel in the Effect Mixer is a bit of a strange thing to consider.
The biggest issue is this: the Effect Mixer assumes that the two video streams do not use alpha. It actually premultiplies the input colors, assuming that they are straight alpha, which works as expected as long as the alpha is full -- but this is actually a bit of a bug if the streams actually do have non-full alpha pixels.
Now, for a mode like "add max" it probably makes sense -- whichever alpha is greater "wins" and that's the one passed to the output.
For something like "add ovr" it's bit more weird to consider. What happens if you add two alphas and they "wrap around" to a lower value (e..g, 192 + 128 = 320 which ends up being 64 after the wrap around.)
For something like "and" which performs a binary and operation on the two values, I don't know what would happen to the alpha. Might be pretty bizarre, which is sort of the usefulness of the Effect Mixer anyway.
In any case, I have prepared a patch for you to consider. It recreates the 'addmax' and 'addovr' modes but with two different ways to control the alpha.
In Scenes 1 and 2, the GLSL shader offers the 'alpha 1 amt' and 'alpha 2 amt' inputs. These allow you to mix the amount of alpha from the first image and from the second image. By changing these inputs, you modulate the amount of alpha transferred from the two source images to the output.
In Scenes 3 and 4, the GLSL shader simply selects the maximum alpha value from the two images.
Note that for these examples work properly, the video input to the GLSL Shader actor must be unpremultiplied. I've used the Alpha Tool actor to do this.
See if this inspires any ideas for you.
Best Wishes,
Mark
effect-mixer-alpha.zip