The Segmentation Template lets you easily segment a portion of the camera and replace it with an image, tiled image or post effect coloring. Multiple segmentation types are supported including portrait background, hair, sky and more.
Select Segmentation Controller Object
To tune the Segmentation Template, select the
SegmentationController [EDIT_ME] object in the
Objects panel and then tune its settings in the
Set Segmentation Texture
To modify what part of the image is segmented, modify the segmentation texture resource found in the
Resources panel. To do this, select the
Segmentation Texture [EDIT_ME] object, and in the
Inspector panel, modify its settings.
Type dropdown to select the part of the image that will be segmented. You can segment:
- Portrait Background
- Portrait Hair
- Portrait Shoulder
- Portrait Head
- Portrait Head
All of the segmentation textures can be inverted by enabling the
You can change how the borders of the segmentation looks by modifying the
Refine Edge option.
To enable a solid background color, make sure the
Use Background Color checkbox is checked.
Once enabled, you’re able to tune the solid background color and alpha. This background color will be masked by your selected Segmentation Texture.
To enable a segmentation masked image, make sure the
Use Image checkbox is checked.
After selecting you image type, you’ll want to assign the image texture. To add a texture to Lens Studio, drag and drop a PNG or JPG to the
Resources panel. Alternatively, select
+ -> Import Files from the
Resources panel. Then, click the
Image Texture field and assign it to your newly imported texture.
You have control for how transparent your image will be via the
Image Alpha slider.
Set Blend Mode
You can set your image blend mode using the
Image Blend Mode drop down. Available blend modes are
Tiled checkbox is selected, your image is tiled. This tiled background will be masked by your selected segmentation texture.
The following options in the
Inspector panel allow you to configure the tiling.
- Tile Density - How dense the tiled pattern is. Smaller number = smaller tiles. Bigger number = bigger tiles
- Scrolling - If enabled, the tile pattern will play a scrolling animation
- Scroll Speed X - How fast the tile pattern scrolls in the horizontal direction
- Scroll Speed Y - How fast the tile pattern scrolls in the vertical direction
Tiled checkbox is not checked, your image texture will be used as a single background image. This image will be masked by your selected segmentation texture.
When using a non-tiled image, you can configure how the image fills the screen by selecting from the
Fill Mode dropdown.
To enable post effect, make sure the
Use Post Effect checkbox is checked.
When enabled, a post effect will be applied to the camera feed, masked by your selected segmentation texture.
You can change your post effect texture by selecting the field next to
Post Effect Texture in the
Inspector panel. Then select a post effect resource. To add a new Post Effect type, select
+ -> Post Effect Textures in the
Resources panel or create your own by following the Post Effect guide.
You can also tune the transparency of the applied post effect.
Adding Additional Objects
To add an additional object that lives on top of the segmentation mask (not segmented). Simply use
+ from the
Objects panel as you normally would. As long as the objects are set to either the
Orthographic Camera layers, the object will not be segmented by the mask.
To add an additional object that is segmented, you need to assign your object to the appropriate camera render layer. For perspective camera objects, set your object’s render layer to
Masked. For orthographic camera objects, set your object’s render layer to
Previewing Your Lens
You’re now ready to preview your Lens experience. To preview your Lens in Snapchat, follow the Pairing to Snapchat guide.
Please refer to the guides below for additional information:
Still Looking for help?Visit Support