Just like the Source parameter, the Mask parameter is an image-type parameter that lets you connect to a graphic source, whether it be a Reader or a Generator. You can connect it to the exact same types of graphic elements and apply Modifiers to it. Its purpose is to make the layer pixels disappear, usually partially, based on the Alpha channel of an external image.
To make the way that a Mask entry can be used a bit more tangible, let's imagine that we have two images:
- One representing a living room
- The other representing the silhouette of a keyhole that has an Alpha layer
Test it by yourself by downloading the living room and keyhole images
The first image is connected to the Source input, while the second is connected to the Mask input.
Only the pixels inside the Alpha channel of the Mask input are kept. Pixels outside will be considered transparent, giving the impression that they have disappeared.
If the element used as a Mask does not have an Alpha channel, Modifiers like Shuffle or Channels Math allow you to shuffle the channels.
Enabling and disabling masks
Using a Mask can sometimes prevent you from seeing the whole Source, which makes it difficult to work on. So you can disable the Mask by unchecking the Enable Mask switch.
When a layer undergoes transformations, it is possible to define whether or not the Mask must follow them. There is a Transform Mask switch for this. In the case of our previous example, this allows you to leave the keyhole in its place, or on the contrary, to lock it with the Source during the transformation.
Let's see the process from the beginning:
External resources: Living room photo: https://pxhere.com/fr/photo/1367038