Search Unity

Resolved ARFoundation AR Face reversed

Discussion in 'AR' started by carlosfgzz, Mar 3, 2021.

Thread Status:
Not open for further replies.
  1. carlosfgzz

    carlosfgzz

    Joined:
    Jan 23, 2021
    Posts:
    7
    Hi all.

    I'm fairly new to Unity and I'm doing some tests detecting face with ARFoundation but the face mesh always shows like inverted or with normals inverted as shown in the images. I followed this tutorial:


    What could be the problem and what solution do you recommend me to follow to straighten the AR face mesh.

    Thank you.
     

    Attached Files:

  2. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,142
    I'm not sure why this happens for you, but maybe I can help with the general direction of thoughts.
    Your issue is very similar to setting the 'invertCulling' to false on Android. You can achieve the same "face inversion" result if you disable the ARCameraBackground component on ARCamera. The ARCameraBackground is responsible for setting inverted culling to true on Android:
    Code (CSharp):
    1. commandBuffer.SetInvertCulling(m_CommandBufferCullingState);
     
  3. carlosfgzz

    carlosfgzz

    Joined:
    Jan 23, 2021
    Posts:
    7
    Thank you very much for your reply KirillKuzyk. I tried disablig the ARCameraBackground component on ARCamera as you suggested but now all the background is black when I run on my device (image below), just the collar ref mesh is shown. What else do you think I could try to fix this?

    Also, where do I implement the code you suggested?
    Code (CSharp):
    1. commandBuffer.SetInvertCulling(m_CommandBufferCullingState);
    Thanks.
     

    Attached Files:

  4. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,142
    Unfortunately, I don't have a solution to your problem. I just pointed out that your issue is very similar to setting 'invert culling' to false on Android. AR Foundation (ARCameraBackground.cs) is responsible for setting this setting to a correct value, there should be no need to set it manually.
     
  5. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,820
    After connecting with the team, it was suggested that you try a later version of AR Foundation, like version 4.1.
     
  6. carlosfgzz

    carlosfgzz

    Joined:
    Jan 23, 2021
    Posts:
    7
    Thank you very much KirillKuzyk for trying to help and TreyK-47 for your answer.

    I'm using Unity version 2019.4.19f1, updated to version 4.1 of AR Foundation as suggested and when I tested on my Samsung Galaxy A70 the screen showed completely black and never got the "allow camera" message. Is there any additional option I need to adjust?

    I'm also downloading and installing Unity version 2020.3.0f1 to test with the AR Foundation version it comes preloaded and let you know if anything changes.

    Thaks for the help.
     
  7. carlosfgzz

    carlosfgzz

    Joined:
    Jan 23, 2021
    Posts:
    7
    Finally I was able to display correctly the face mesh (image attached) using Unity version 4.20.3 and AR Foundation 4.0 and also following all of this helpful tips:

    Video tutorial:


    Tips:
    https://levelup.gitconnected.com/th...ation-app-display-a-black-screen-3b5b505c28b1

    Also I needed to explicitly select the camera direction to "User" in the ARCameraManager component in the AR Camera because it was always facing the "World".

    Thank you very much for guiding me to the right direction.

    Hope this help anyone with the same problem
     

    Attached Files:

  8. rickyrichk

    rickyrichk

    Joined:
    Apr 18, 2021
    Posts:
    2
    hi, i also have the same problem like that, how to fix it?
     
    theolagendijk likes this.
Thread Status:
Not open for further replies.