How can I create a face inset with hair segmentation?
Subtropic Studios
Posts: 2
I am looking to create a mask that includes face inset and hair segmentation, similar to attached examples. I know there is a way to create this mask, but I'd like for it to be pinned to certain areas in the screen so that its only detecting face + hair.
Examples:
https://t.snapchat.com/JUBt1rU8
https://t.snapchat.com/mFnkmp9T
https://t.snapchat.com/1GtBuTkA
0
Best Answer
-
To create a mask that combines both of these features, you will need to use some SnapML models and components.
One possible way to do this is:
- Add a SnapML component to your scene and import a model that can segment the user’s hair. You can find some examples of such models on Fritz AI or Lens List.
- Add a Camera Texture component to capture the camera input and connect it to the SnapML component’s input texture.
- Add an Unlit material and set its base color texture to the camera texture. Set its opacity texture to the SnapML component’s output texture. This will create a transparent mask of the user’s hair.
- Add another Unlit material and set its base color texture to black. Set its opacity texture to the same SnapML component’s output texture, but invert it by selecting Invert Mask in the Inspector panel. This will create a black background for the user’s hair.
- Add two Screen Image components and assign them each one of the Unlit materials. Adjust their size and position on the screen as you like.
- Add another SnapML component and import a model that can segment the user’s face. You can use one of Lens Studio’s built-in models for this purpose.
- Connect another Camera Texture component to this SnapML component’s input texture.
- Add another Unlit material and set its base color texture to black. Set its opacity texture to this SnapML component’s output texture, but invert it by selecting Invert Mask in the Inspector panel. This will create a black background for the user’s face.
- Add another Screen Image component and assign it this Unlit material. Adjust its size and position on top of one of the hair masks. This will create a face inset with hair segmentation.
Quick links with useful info for you to unpack
0