Face Expressions
This guide shows how you can use face expressions of the user to drive a 3D model using the Face Expressions effect. For example, you can bring in a 3D character that repeats the user's face expressions!
Guide
There are 51 expressions available overall, each of them corresponds to specific user emotion or facial muscle movement. For each of them, there is a "weight" parameter. Weight is a number which indicates how strong this expression is.
For example - EyeBlinkLeft
has weight closer to 0.0
when users left eye is fully open, and goes up when the user blinks. It's different and unique for every face, so there is no guarantee that it ever reaches 0.0
or 1.0
.
You can see the list of expressions available in the API page. Though optional, by using the names listed on this page, it will make it easier to hook up your model to this template.
Face Expressions Asset
Find the Face Expressions
asset in the Asset Library and import it into your project. Click here to learn more about how to use assets in the Asset Library.
The Face Expression asset comes with two examples of driving 3D models based on the Face Expression feature. Toggle the Character Expressions
and the Face Mesh Expressions
to see them in action.
Hooking up your model
Each of these objects utilizes the ExpressionController script which allows you to set up which face expressions will drive animation of your 3d model blend shapes.
To learn about making your own model, take a look at the 3d animation guide for more information.
To hook your model up, select the Mesh Component
field, and choose the Render Mesh Visual component on your object. At this point, if the blendshapes on your object matches those listed in the API page, your model will automatically be driven by the Face Expression feature.
To bring your 3D model into Lens Studio, drag and drop the file into the Asset Browser
panel.
Customizing your expressions
You can modify how the ExpressionController maps your face expressions by toggling the Customize Expression checkbox. All of the expressions are divided into categories and sorted alphabetically for easier search.
- Brows
- Cheeks
- Eyes
- Jaw
- Lips
- Mouth
- Face
Scale parameter is used to multiply actual face expressions weight, so you can get exaggerated effect without editing animation in model.
We’re continually upgrading the model which understands the shape of your face expression. As a result, you should not rely on the Scale parameter for big changes.
Blendshape - name of the blendshape in 3d model that you want to map to the current face expression blendshape.
The Face Mesh option under the Advanced field provides a reference Face Mesh object that the face expression blendshapes are derived from. This needs to be enabled at all times when face expressions are in use. The template applies a transparent material that you can add to it, so it won't interfere with other rendered objects.
Eyeball Tracking
This asset also provides a helper script to help you use only the rotation of the eye tracking feature. In the Character Expressions
example, the character’s eye moves with the user’s eye, but its position is positioned by the model itself.
To use this helper script, add the Copy Rotation
script to your eye object. Then, set the corresponding Eyeballs to the Source Object
, and your model’s eye object to the Target Object
.
Previewing Your Lens
You’re now ready to preview your Lens! To preview your Lens in Snapchat, follow the Pairing to Snapchat guide.