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
+ -> 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.
Any segmentation texture can have their edges feathered. Change the
Feathering slider to tune the feathering sharpness.
Any segmentation texture can have their edges refined by clicking the
Refine Edge checkbox. When this is enabled, post-processing algorithms are applied to the segmentation resulting in a higher quality mask. We recommend utilizing Refine Edge for most use cases.
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.
Try adding an object to your scene now, and you can see that the part of the object outside the portrait is masked out.
You can tick the
Invert Mask checkbox as mentioned above to get the object to look like it's behind the user.
Similarly, you can apply a
Mask Texture on the Orthographic camera to have your Screen Images show behind the user's portrait.
Finally, you can also add an
Opacity Texture to your materials to mask out specific materials. To do this, make sure a
Blend Mode which allows transparency is selected (e.g.
Normal), and then enable the
Opacity Texture checkbox. You can then put your opacity texture in the
Texture field under the
Opacity Texture section
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