How to create an AR Face with Face Paint
Last updated
Last updated
Using a given face paint reference you can create your own AR face paint. This refers to a type of augmented reality application that allows users to apply virtual face paint or makeup to a user's face in real time using a camera feed. This enhances a user's appearance by overlaying digital cosmetics onto their face, creating various artistic or cosmetic effects. Inside Easy AR you can see the second example (tiger face) is face paint. Follow the steps given below to create your own AR face paint.
Step 1: Go to Face filter scene by double clicking on Face filter scene inside Easy AR -> Scenes folder
Step 2: Click AR Session Origin game object and inspect the Switch Face script. Under the Face Prefabs list click + button. It will add a new object to the Face Prefabs list.
Step 3: Go to Assets -> Easy AR -> Prefabs -> Face Filter folder. Find ReferenceFacePaint prefab.
Step 4: Drag and drop ReferenceFAcePaint prefab into the newly added listMask Prefab. You can add any mask icon sprite into Mask Icon or you can ignore it. (For example, the mask icon is ignored)
Step 5: Now go to File -> Build settings. In the Build settings window choose your build platform and build the apk.
Once you build this build, go to the Menu -> Face filter demo. You can see a new empty button on the bottom panel. Click it and you can see new face paint with reference texture. Using this reference face you can identify which section you need to paint on your new face paint
Now you have a pretty understanding of which face segments need to be painted. Let’s start painting.
Step 1: Go to Assets -> Easy AR -> Textures -> Face Filter folder. Find FaceUV.png which is your reference image. Add your reference image to photo manipulation software like Adobe Photoshop or Adobe Illustrator.
Step 2: Create a new layer in the layers panel. Then paint your face paint according to the reference AR face build before. For example, we paint our tiger face on the new layer on top of the reference texture.
Step 3: Once you complete the face paint, disable the reference texture and export only your face paint layer as a png image.
Step 4: Then import this face paint image to Unity Easy AR -> Textures -> Face Filter folder.
Step 5: Then go to Easy AR -> Materials -> Face Filter folder. Create new material by right click -> Create -> Material.
Step 6: Name this material as your face paint name, in our case tiger. Set material shader to Standard in the inspector. Set Rendering mode to Fade. Set Face paint texture (Tigerface.png) as Albedo map
Step 7: Go to Easy AR -> Prefabs -> Face Filter folder. Duplicate the ReferenceFacePaint prefab and change its name to your facepaint name. In our case, we painted Tiger Face so name it as TigerFace. Double-click to load the prefab.
Step 8: Click the TigerFace game object. In Inspector under mesh renderer materials set newly created tiger material.
Step 9: Then go back to the face filter scene and select the AR session origin game object. In inspector remove reference AR Face from list in the Switch Face script. Attached to game object. Add your newly created prefab (in example Tiger face) to a new item on the Face prefabs list. If you have an icon for the button convert that image to sprite type and Add to mask icon box.
Step 10: Now it’s time to build the apk. Go to File -> Build Settings. In the Build window make sure you added the Face Filter scene. Choose your build platform and build the apk.