Patch Editor
Render Pass Patches
Segmentation Processing with Render Pass Patches

Segmentation Processing with Render Pass Patches

Use the Segmentation Processor patch group to soften or dilate the boundaries of person, hair or skin segmentation textures.

Segmentation processing can only be used in projects using the Render Passes capability.

Using the the Segmentation Processor patch group

First, create a project using hair, person or skin segmentation. For support, see our article on segmentation effects.

We have made a simple effect that uses person segmentation to seperate the user from a pink background:

Segmentation effect shown in Simulator.

To add the Segmentation Processor patch group:

  1. In the Assets panel, select the segmentation texture.
  2. In the Inspector, underneath Render Pipeline, click Create.

This will add two new patches to your patch graph:

Two patches are shown in the Patch Editor

The Segmentation Processor patch contains two values that we can edit to change our effect:

  • Edge Softness - Increasing this value makes the outer edge of your segmentation mask less crisp, which can sometimes help you to achieve a more natural look.
  • Dilation Kernal Width - Increasing this value will grow the size of your segmentation mask texture, making it larger than the part of the body which has been segmented.

However, to have these values applied in our effect, we must first change the segmentation mask texture that is being used to one that has been created by our new patch group:

  1. Find where your segmentation mask texture is being applied. Typically, it will be used as the Alpha texture of a material. You can click on the texture in the Asset panel to see a usage list.
  2. In the Inspector, replace the texture with the new one created by the segmentation smoothing patch group. It will be called Segmentation Mask Texture.

You'll now see that adjusting the values in the Segmentation Processor patch changes how your effect looks.

Inputs

NameDescription

Input Image

The segmentation mask texture which you would like to modify.

Edge Softness

The level of softening applied to the edges of the segmentation mask texture. The higher this value, the more blended the segmentation will be.

Dilation Kernal Width

The extent to which the segmentation mask texture extends beyond the bounds of the feature being tracked. A higher value will make your segmentation mask texture larger.

Outputs

NameDescription

Texture

The modified segmentation mask texture. This can be applied by connecting this output to an input that consumes textures, or by selecting the new texture in the Inspector. In the inspector, the texture generated by this patch will be called Segmentation Mask Texture.

Example

Here, you can see what happens as the EdgeSoftness is set to 0, 2.5 and 5:

Three images of the Simulator. The user becomes less and less segmented from the background as the Edge Softness value increases.

And in this example, you can see what happens as the DilationKernalWidth is increased to 10, 20 and 40:

Three images of the Simulator. The white space between the user and the pink background increases as Dilation Kernal Width value increases.