This post will tell you how to create your face beauty filter and configure it with our Effect Constructor. The filter we feature as an example includes the following beautification options:
If you are new to Banuba and you’d like to test Beauty AR SDK, drop us a line via the website contact form, and we’ll be happy to share the trial.
To create a beauty filter for live streaming, you will need 3 types of source files:
FBX file with morphing
Three textures as PNG files for Makeup, Softlight and Highlight.
Three LUT files in PNG format for eyes and teeth whitening and general color improvement.
FBX file with morphing
Morphing allows for modifying the size of the face and its facial features by moving the vertices of the 3D model of the face. You can slim down or enlarge the face, change the shape of the nose, eyes, lips, chin, or produce any other deformations.
You can use the FaceDefault.FBX file with default face as a base model to create your morphed meshes. In our example, we’ll use slight morphing that slims down the face and the nose to make the user's facial features more delicate.
The images below show the base mask and the morphing effect (green mask) added to the base mask (pink mask). The morphing effect will be applied to the recognized face of the user, while the UV coordinates should remain unchanged.
Textures: Makeup, Softlight, and Highlight
Now we will make three textures as PNG files according to the UV scan grid. These textures make up the core of our face beautification webcam filter.
Makeup texture
Softlight texture
Highlight texture
LUT (Look Up Table)
The LUT files enable the color improvement of the entire beauty webcam filters in full-screen mode. This way beautification will look organic, and the user will enjoy an enhanced, more vivid image. Also, we can whiten the user's eyes and teeth.
You can make your LUT file by making color improvements of the image in Photoshop using adjustment layers without masks, and applying these layers to the neutral LUT file.
Please note, files for eyes and teeth whitening should be without an alpha channel, and the file name should begin with the lut3d_ prefix.
Now, as you have all the resources in place, we can construct and configure the beauty webcam filters.
4. Add source files to this new folder: three LUT files and three PNG files with textures (Softlight, Makeup, and Highlight).
Step 1. Basic settings
In the Effect Constructor, go to the Rendering tab:
Click the Construct or Save buttons to save the settings.
Step 2. Setting up the retouch layer
To set up the retouch layer, specify the necessary options for the files.
LUT file for teeth whitening
LUT file for eye whitening
PNG file with the glare in the eyes
Softlight PNG file
Makeup PNG File
Click on the Construct button.
Step 3. Adding color correction
In the final step, we apply the color correction to the entire image to add consistency to our face beauty filter.
Save the finalColorFilter.fsh file to the folder with your constructed effect and insert this code into the config.json file to enable it. In the code, we indicate the name of the LUT file nashville.png saved earlier in the folder with the constructed effect.
"final" : {
"type" : "FILTER",
"filter" : {
"fragmentCode" : "finalColorFilter.fsh",
"textures" : [{
"file" : "nashville.png",
"sampler" : "lookupTexture",
"magFilter" : "LINEAR",
"minFilter" : "LINEAR"
}]
}
}
The example of the beauty filter described above can be used as a real-time effect or for photo post-processing in selfie editors. You can see more of Banuba video face beautification and retouch features from the video.
A face beauty filter for live streaming makes the users feel more comfortable about their selfie camera experience, increases engagement with the live stream session, and inspires content creation in users.
You can adjust beautification features and levels creating either the effect of natural beautification with slight use of face modifications or producing Snapchat-like retouch and beauty filters.