6
$\begingroup$

Maybe I am missing it but I can't find a compositor node that simply lets me switch between 2 images including the alpha channel based on a factor.

Here's a simplified setup description:

I have a background image and two overlay title images, titleA and titleB, that have alpha channels. I want to be able to overlay either titleA or titleB over the background according to a factor. I.e. when the factor is 0 I want titleA overlayed, when the factor is 1 I want titleB overlayed.

It is easy enough to use the Mix node to switch the non-alpha channels. But I can't get it to switch the alpha channel. It seems to be able to give me only either the alpha from titleA or titleB or some combo of the two. Alpha Over doesn't seem to do this either.

Here's the simplest version of the setup I've tried. I'm using a Value node to change the factor between 0 and 1. Here it is with 0:

Factor 0

Here it is with the factor 1:

Factor 1

Note that the alpha channel from titleA is being used instead of from titleB.

This is the crux of the problem. The Mix node outputs the alpha channel of only one of the inputs here. It doesn't switch them like the image.

Also, note that in my real project I have a cascade of titles that I sequence using a Time node and Math(Greater Than) nodes.

I do have a workaround for this where I create a parallel set of Mix nodes just for the alpha channels. That works. But as I need to do a much more elaborate version of this with time curves, etc., I don't really want to have to maintain duplicate networks for alpha channels.

$\endgroup$
6
$\begingroup$

Here's what I came up with: Stripping the Alpha channel only to recombine it later using mix nodes. Changing the Value node does the switch:

enter image description here

If you group the nodes it becomes simpler to combine multiple instances;

enter image description here

enter image description here

|improve this answer|||||
$\endgroup$
  • $\begingroup$ I think they mentioned that but were looking for a quicker way. $\endgroup$ – Ray Mairlot Jan 29 '15 at 16:30
  • 1
    $\begingroup$ You could group these nodes $\endgroup$ – someonewithpc Jan 29 '15 at 17:22
  • $\begingroup$ This is what I'm trying to avoid. I came up with essentially the same solution (a little simpler). But it means reproducing the logic multiple times. And since I really have a sequence of many images I need to switch, this is undesirable. $\endgroup$ – Chuck Jan 29 '15 at 17:26
  • $\begingroup$ I guess the group nodes that you added simplify things a bit. But it still means there is extra processing taking place. $\endgroup$ – Chuck Jan 29 '15 at 18:04

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.