# Creating custom textures and 3D models for Augmented Faces

To implement Augmented Faces, you need customized textures and models for
overlaying on identified face meshes. These assets are created by artists
ahead of time in 3D modeling and animation software, and exported as `*.fbx`
files.

The Sceneform SDK for Android ships with a `canonical_face_mesh.fbx` file and a
`canonical_face_mesh.psd` file to help artists create assets that will overlay
properly onto faces detected by ARCore. These files can be found in the
`assets` folder.

## Using the `*.fbx` file to create assets

The `*.fbx` file contains the face mesh topology, UV texture coordinates, and
rig that define the supported facial regions provided for creating and
attaching assets. To ensure they're compatible with ARCore,`*.fbx` files should
be saved using supported settings. You can then import these files into your
project as `*.sfb` files.

This file contains a reference `facemesh` that should not be exported as part of
the final `*.fbx`. ARCore will generate and update a separate face mesh at
runtime.

## Using the `*.psd` file to create assets

The `.psd` face mesh reference texture is used to see how a texture that an
artist creates lines up with a user's facial features at runtime. It includes
four layers:

- **Mask:** Shows where the eyes, nostrils, and mouth are located in the texture.
- **Lines:** Guidelines that show how a user's facial features line up with a texture during runtime.
- **UVs:** Represents triangulation of the 468 point face texture mesh.
- **Background:** A neutral gray background layer to make the other three components visually clear.

If you modify the `*.psd` file, you should see your changes as soon as you
export.

## FBX asset format and requirements

We recommend and support the following settings for `*.fbx` files exported from
modeling and animation software.

- File format: FBX 2016/2017 or later

- Axis conversion: Up axis is Y

- Scale factor: Centimeters

- Required geometry settings:

  - Smoothing groups
  - Smooth mesh
  - Referenced asset content
- Recommended geometry settings:

  - Tangents and binormals
  - Triangulate
  - NURBS
- Animation: enabled

- Deformed models settings:

  - Deformed models
  - Skins

### Customizing the canonical face mesh

If models and textures are being created using the
`assets/canonical_face_mesh.fbx` included in the SDK, these settings are also
required when exporting `*.fbx` files:

- Make sure the any custom meshes are skinned to the associated bones or regions.

- Use the following hierarchy:

  ```
  asset
  |__root
  |   |__NOSE_TIP
  |   |__FOREHEAD_RIGHT
  |   |__FOREHEAD_LEFT
  |__facemesh           <-- for reference
  |__                   <-- place additional custom 3D meshes here
  ```
- Do not export the included `facemesh` model. This mesh is for reference only.
  ARCore will create a separate face mesh at runtime. Use the UVs in `facemesh`
  as a reference when creating custom face mesh textures.

- Place custom meshes as children of the `asset` node.

- Use of namespaces is supported.

- The asset contains four bones consisting of `root` and three regions:
  `NOSE_TIP`, `FOREHEAD_RIGHT`, and `FOREHEAD_LEFT`. Do not change the names
  of these bones.