Layering in Blender with the alpha channel
To perform layering in Blender Compositing, the alpha channel can be used either with the Mix node or Alpha Over node.
Layering with the Mix node
The following screenshot depicts the process of layering using a Mix node. A background image is connected to the upper Image socket and a foreground image to the lower Image socket of the Mix node. Now the result shows only the aliased RGB channel of the foreground. If the foreground image has an alpha channel associated, then Include Alpha Toggle should be used in the Mix node, as shown in following screenshot:
If the foreground image doesn't have the alpha channel, then a separate alpha image can be fed to the Fac socket of the Mix node to obtain the same result. Alternatively, if the combined channel is accessible, then a Separate RGBA converter node can be used to extract the alpha channel from the combined pass information and can be fed to the Fac input of the Mix node, as shown in the following screenshot...