Clear
Back

The Face Tracker Texture and Face Swap Effects

You can use the video of someone's face when they're using the effect as a texture in your scene, by extracting the face tracker texture.

You can then apply the texture to a material and object - for example, to create a face swap effect.

Learn about:

  1. Creating a texture from the face tracker.
  2. Using the texture in an effect.
  3. Creating a face swap effect.

To use the video captured of the entire scene, use the camera texture instead.

Creating a texture from the face tracker

  1. Add a face tracker to your scene.
  2. Select the face tracker in the Scene panel.
  3. In the Inspector, click + next to Texture Extraction.


You'll see a texture called faceTracker0 in the Assets panel:

Using the texture in an effect

The texture can be applied to any material channel. It's a good idea to use a flat material. Or, drag it into the Patch Editor to combine with other visual shader patches.

If you select the texture in the Assets panel, you'll be able to see and edit its properties in the Inspector.

Copy Mode

There are 2 options to choose from here.



3D Direct

Use this option to create a 3D representation of the user's face. You'd generally use this mode when applying the texture to a face mesh, for example in a face swap effect.

2D Bounding box

This mode will create a flat cutout of the face. You could use this mode to create 2D animations featuring the user's face.

Enable Opening and Alignment

If the texture is applied to a face mesh, check the boxes next to Eyes and Mouth. This will make sure the texture aligns properly with the face mesh.

Creating a face swap effect

Start by adding the face trackers:

  1. Add two face trackers to your scene.
  2. To help keep track, rename the face trackers - name the first face_1, and the second face_2.

Then, edit the second face tracker so that it responds to the second face to appear in the scene:

  1. Select face_2 in the Scene panel.
  2. In the Inspector, set Tracked Face to Face 2.

Next, create the face mesh, textures and materials:

  1. Extract the face tracker texture for each face tracker.
  2. Create 2 face meshes, each as a child of one of the face trackers.
  3. Create a material for each face mesh, and set the Shader Type to Flat.
  4. Apply each face texture to the material applied to the opposite face tracker in the scene.

The face mesh will have hard edges. To blend these with the face, use the face mesh mask included in the face reference assets.

Join the Spark AR Creator's community

Find inspiration, see examples, get support, and share your work with a network of creators.

Join Community

Join the Spark AR Creator's community

Find inspiration, see examples, get support, and share your work with a network of creators.

Join Community

Frequently asked questions

Have a specific question? Maybe it's been answered.


Read FAQs
Was this document helpful?