Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question I want to use AR occlusion manager only for getting the distance with Depth API.

Discussion in 'AR' started by kibisi, Dec 2, 2021.

  1. kibisi

    kibisi

    Joined:
    Feb 1, 2020
    Posts:
    3
    Dear Developer
    I could put the AR object by using the distance which is provided by AR occlusion manager's depth image information.
    But, in our use case, I do not want to hide the AR object by Occlusion.
    Could you share me the solution for the above?
    upload_2021-12-2_13-20-30.png upload_2021-12-2_13-20-49.png
     
  2. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,128
    You can write a custom camera background shader that doesn't write to the depth buffer.
     
  3. kibisi

    kibisi

    Joined:
    Feb 1, 2020
    Posts:
    3
    Thank you for your supporting! I could not come up with such as your idea.
    Unfortunately, I am not familiar with writing shader which meet the cording you mentioned.

    If you can, could you share its one of the example?
     
  4. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,128
    Here is an example shader for ARKit. I simply commented out lines 178 and 181 to disable depth writing.
    To use the shader: create a material with this shader, then enable the 'Use Custom Material' on ARCameraBackground, and set a reference to created material.
     

    Attached Files:

  5. kibisi

    kibisi

    Joined:
    Feb 1, 2020
    Posts:
    3
    Thank for kindly supporting with the detail information! I will try by utilizing the script.
    Once I could, I would like to share its result.
     
    KyryloKuzyk likes this.