In this template, you can take a look at 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!
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
Tip: 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.
The Face Expression template 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.
Tip: 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
Blendshapes Component field, and choose the Blendshape 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.
Tip: To bring your 3D model into Lens Studio, drag and drop the file into the
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.
Scale parameter is used to multiply actual face expressions weight, so you can get exaggerated effect without editing animation in model.
Warning: 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.
Warning: 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.
If your model has eyes, you can move them with the user’s eye using the Eyeball Tracking feature. To do this, drag your model’s eyeball object underneath the respective eye object.
This template 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
For debug purposes there is a UI panel that shows different face expressions and their corresponding weight.
In the Lens preview, you can click and drag through the list to see each expression's value at any given time.
You can pick the expressions you want to see in the debug UI panel by toggling the
Customize Expressions checkbox.
You can also modify the color for each group of face expressions under the
Note: There’s a few other options in this section, but you likely don’t need to modify this.
Previewing Your Lens
You’re now ready to preview your Lens! 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