AnyPortrait > Manual > Combining Masks
AnyPortrait v1.6.0 improved Mask, which allows you to combine one clipping mask and four alpha masks for each channel to apply to clipping rendering.
In particular, you can optionally set the operation method when applying the alpha mask to the clipped mesh.
This page covers how to combine multiple masks by passing them to the clipped mesh.
Note
For Mask, we recommend that you first read the following manual.
You can also check out Shared Texture, which has a similar behavior to what is covered on this page, in the following manual.
- Mask
There are two meshes ("Mask Circle", "Mask Rect") and one mesh to be clipped ("Clipped Star").
Let's create two masks and apply them to one mesh at the same time.
Let's open the Mask Setting Dialog and set the mask.
(1) Create Mask Data for the first mask mesh ("Mask Circle").
(2) Register the target mesh to receive the mask ("Clipped Star").
(3) Register a property of type "Alpha Mask Preset".
Here, set the value of Channel to "Channel_1" and set Mask Operation to "And".
(1) Create Mask Data for the second mask mesh ("Mask Rect").
(2) Register the same mesh as before ("Clipped Star") as the clipping target.
(3) Register a property of type "Alpha Mask Preset".
If two masks target the same mesh, you need to make sure that each mask is input to a different property.
In the case of "Alpha Mask Preset", this is distinguished as "Channel".
(1) In the property of the second mask data, change the value of Channel to "Channel_2".
"Alpha Mask Preset" transmits mask data by dividing properties by "Channel" units.
Thanks to this characteristic, it is possible for two or more mask meshes to clip the same mesh.
The clipping operation order is that the existing "clipping mask" is calculated first, and the alpha mask is calculated in order starting from "Channel 1".
(1) When you close the Mask Setting Dialog, you can see that two clipping masks are applied to one mesh (“Clipped Star”).
(2) In the Hierarchy UI on the right, you can see that the two masks are transferred to one mesh through icons.
Currently, you can see that the two mask meshes are clipped to the "common area".
This is because the calculation method value of "Alpha Mask" is set to "And".
Let's see how the result of combining the masks changes when the calculation method is changed.
(1) Select the Mask Data for the "Mask Rect" mesh sent to "Channel_2".
(2) Let's change the values of Mask Operation one by one and compare the results.
You can see that the combined results of the clipping masks change depending on the operation method.
- And : Clip to the common area with the mask in the previous channel.
- Or : Clip to the entire area including the mask from the previous channel and the current mask.
- Inverse And : Perform And operation with the inverted value of the alpha mask.
- Inverse Or : Perform Or operation with the inverted value of the alpha mask.
Note
The result of a mask combination is affected by the order of mask operations on the channels.