Just like the Source parameter, the Mask parameter is of type Image, making it possible to connect to a graphic source, whether it is a Reader or a Generator. You can connect it to the exact same types of graphic elements as well as 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 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. The 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. It is therefore possible to disable the Mask by unchecking the Enable Mask switch.
When a layer undergoes transformations, it is possible to define whether the Mask must follow them or not. 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