Unity Ar - Hat render in front of face

I’m trying to create an Ar Face filter app like Snapchat but the issue is when I try to create filters and spawn props like hats, and glasses it spawns just in front of the face and it’s looking weird.

I want do a mask on the hat or not render that part behind the face .

I can’t find any solution to solve this issue.

If anyone know any solution?

I found that other people are also getting the same issue.

This is not my video I just searched for it on YouTube

I didn’t try, but here is 1 thought:

  1. Place a 3D Head behind the mask.
  2. Apply a shader to the Head that doesn’t render the front part of the object, but blocks what is behind the head.

@makaka-org-support I already tried it but the issue still occurs.

What shader did you try?

Default Shader of Unity

URP/Lit

  1. What is the Default Shader of Unity?
  2. How did you customize them to achieve the goal?
  3. Did you try to create your own shader using Shader Graph?

Q: What is the Default Shader of Unity?
A: Universal Render Pipeline / Lit (Default shader of URP)

Q How did you customize them to achieve the goal?
A: I am not using a custom shader.

Q Did you try to create your own shader using Shader Graph?
A: No

→ I’m not using any custom shader currently. I have downloaded 3D models from the Unity Asset Store.
→ Do you know any Tutorials on this topic?

The feature you are looking for is called Occlusion. Here’s some resources to get you started.

Docs: Occlusion | AR Foundation | 6.0.3
Samples: GitHub - Unity-Technologies/arfoundation-samples: Example content for Unity projects based on AR Foundation