Search Unity

Hide GameObjects under a hidden or transparent detected plane in ARFoundation

Discussion in 'AR' started by soorya696, May 25, 2019.

  1. soorya696

    soorya696

    Joined:
    Dec 13, 2018
    Posts:
    71
    Hi,
    I want to hide the game objects if the object goes under the detected plane while translating it up and down. Does anybody know how to achieve this?
     
  2. OlivierHoel

    OlivierHoel

    Joined:
    Dec 15, 2017
    Posts:
    7
    The simplest way is to instantiate a plane with a specific material that only renders to depth buffer (and not color). Also ensure that this renders before any opaque object.
     
  3. soorya696

    soorya696

    Joined:
    Dec 13, 2018
    Posts:
    71
    Thanks for the response.
     
  4. soorya696

    soorya696

    Joined:
    Dec 13, 2018
    Posts:
    71
    Finally, I got a solution. Just add a material with Occlusion shader from "shader->XR/VR->Occlusion" to the plane prefab.
    That's all. The shader will do the magic.
    Maybe helpful for someone.
     
  5. knightcube

    knightcube

    Joined:
    Oct 16, 2018
    Posts:
    15
    Where do I find this shader?