Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question How to do Occlusion in MARS?

Discussion in 'Unity MARS' started by mklitsner, May 10, 2023.

  1. mklitsner

    mklitsner

    Joined:
    Nov 2, 2018
    Posts:
    6
    I've been using Unity MARS for almost a year now and am at a loss as to how to get Occlusion working. I tried adding AR foundation's Occlusion Manager to my MARS camera and set it up just like in a normal AR foundation setup, but its doesn't seem to do anything. I'm also in URP. I would love to know what to do here, I feel like I'm missing something since there's no other questions about this anywhere else
     
  2. CiaranWills

    CiaranWills

    Unity Technologies

    Joined:
    Apr 24, 2020
    Posts:
    199
    Hi - can you tell us which version of Unity and what versions of the AR Foundation packages you are using? And is this on Android or iOS?
     
  3. pacuum

    pacuum

    Joined:
    Apr 14, 2016
    Posts:
    5
    I have also tried to get humanDepthTexture and humanStencilTexture on iOS, but I have had no success.

    My setup:
    • I created a sample MARS app with body tracking.
    • I attached the AR Camera Manager and AR Occlusion Manager to the MARS Session > Main Camera.
    • I attached another script that gets humanDepthTexture and humanStencilTexture in the Update() function and writes them to the log.
    The problem:

    Both humanDepthTexture and humanStencilTexture are null.

    What I have tried:
    • Adding an ARSession besides MARSSession. But it did not work.
    If I do the same setup with a new project from the "AR Mobile" template, it return non-null result.

    My environment:
    • Unity Editor: 2022.3.18f1
    • MARS: 1.5.0
    • AR Foundation 5.1.1
    • Tested device: iPhone 12
    My question:

    Is there anything I am doing wrong? Any help would be appreciated.

    Thank you,
     
  4. pacuum

    pacuum

    Joined:
    Apr 14, 2016
    Posts:
    5
    Some additional information.
    • If I create a new project using the "Mobile AR" template, and attach a script that reads humanDepthTexture, this works fine.
    • But If I add "Body Tracking" from the MARS Panel, humanDepthTexture now returns null.
    • Disabling the "Proxy" script of the Body object does not resolve the issue.
    • Removing the Body object resolves the issue and humanDepthTexture returns a non-null result.
    So it looks like the existence of an object from MARS will disable humanDepthTexture.