Segmentation Textures are masks that are updated in real time based on what is seen in the device's camera. Segmentation textures can be applied to a camera's Mask Texture input to show or hide certain areas of the scene. For example, the Portrait Background Segmentation texture creates a masked image of the portrait of the user. This mask texture can then be used as an input to a camera to only show elements behind the user. It's like a green screen without the green!
Add a Segmentation Texture
To add a new Segmentation Texture, select
Add New -> Segmentation Textures from the
Resources panel. Then select from the provided Segmentation Texture types.
- Portrait Background - Masks out the portrait of the user showing just the background
- Portrait Hair - Masks out everything but the user's hair. Allows you to color or apply a texture to the hair
- Portrait Shoulder - Masks our everything but the user's shoulders
- Portrait Face - Masks out everything but the user's face. This does not include the user's hair
- Portrait Head - Masks out everything but the user's head. This does include the user's hair
- Sky - Masks out everything in the scene but the sky. Great for rear camera experiences where you want to put content in the sky
Segmentation textures can be tuned by selecting them in the
Resources panel and tuning its settings in the
Any segmentation texture can be easily inverted by clicking the
Invert Mask checkbox.
Segmentation textures can have different types of smoothing as well. These can be configured by selecting from the
Mask Smoothing drop down. The options available are:
- No Smoothing - This is the pure segmentation mask
- Refine Edge - Post-processing algorithms are applied to the segmentation resulting in a higher quality mask. We recommend utilizing Refine Edge for most use cases
- Feathering - This applies a feathered border to the segmentation mask with a tunable sharpness
Mask the Camera
Now that you have a new Segmentation Texture added to your
Resources panel, in most cases, you'll want to use this texture as a mask for a camera. To do this, select your camera in the
Objects panel. With the camera selected, in the
Inspector panel, set the
Mask Texture field to your newly created Segmentation Texture.
Your camera's output will now be masked by the selected Segmentation Texture.
When using segmentation, we recommend checking out the Segmentation Template. The template has a controller that allows you to easily add a background color, image, tiled image, post effect and more segmented by your selected Segmentation Texture.
Still Looking for help?Visit Support