Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Feature Request Global Ground Level Cut Off Plane Solution for URP

Discussion in 'AR' started by patek-monsarrat, Dec 28, 2022.

  1. patek-monsarrat


    Nov 21, 2022
    Does anyone know if a complete solution for ground in AR exists somewhere? I mean having an invisible plane that:

    - cuts off rendering of all meshes/particles/sprites below set Y world value (0 being ground level)
    - catches shadows

    It is not much, sounds like a very basic thing to have for AR, yet I am scouring web wide and far and all I am finding are fragments of the solution and confused people trying to piece something together.

    Have a look at what is happening in my project at the moment.

    1. To cut off rendering of meshes below Y=0 I use this custom function connected to a shader like so:

    This is all cool, but I need to apply this to every single shader and it causes issues with transparent objects and particles, they just don't look the same sometimes and its all problematic. Not to mention some of the shaders are pure HLSL and I have no idea how to translate these nodes into HLSL.

    2. My shadow solution is this great asset:

    3. Sometimes things needs to be shown below the ground level like this crater here.

    I am using stencils to achieve that. For a moment I was hoping to add stencil shader code to the shadow receiver code, but I have learned that I cannot use stencils for global plane cut off. With stencils it is always an intersection of two meshes that gives you desired result, and an infinite ground plane reaches only to certain height. I was ending up with geometry being cut off from top or bottom depending on the angle of the camera. It just did not do it.

    Wouldn't it be nice if there was a ground AR plane that solves these basic issues in AR Core pack by default? I know every project is different some some are more complex than others, but how about at least a guide to deal with this stuff? Isn't it a common enough issue?

    Attached Files:

    Last edited: Dec 28, 2022
  2. DevDunk


    Feb 13, 2020
    While being helpful, I don't think this will be a default feature for Unity. It's too specific. Shadow reveiving would be something that would be nice as a default in AR foundation, stencil is a standalone feature, but the mix seems to be up to developers

    This could be possible with a text based shader which also sets the stencil buffer. (I also made a feature request for stencil buffer integration in shader Graph, you could do the same)
    newguy123 and patek-monsarrat like this.