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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question In URP DBuffer decal, can decals are drawn on top of the 5th and the subsequent terrain layers ?

Discussion in 'Universal Render Pipeline' started by MHCarrot, Aug 1, 2022.

  1. MHCarrot

    MHCarrot

    Joined:
    Feb 2, 2021
    Posts:
    3
    Hi, I'm trying the Decal Renderer Feature in a terrain map.

    My environment is the following.
    ・Unity 2021.3.6f1, URP 12.1.7.
    ・The technique setting of Decal is "DBuffer".
    ・A terrain object is assigned to "Terrain Lit Material".
    ・Terrain layers are like 1st:grass01, 2nd:grass02, 3rd:grass03, 4th:grass04, 5th:soil01, and so on.

    I have a problem that decals are drawn under the 5th and the subsequent terrain layers, e.g. 5th:soil01.
    Until the 4th terrain layers, decals are drawn on top of them, and it is just what I expected.

    I hope in the case of the 5th and the subsequent terrain layers decals are drawn on top of them.
    Do you know how to solve this problem?
     
  2. MHCarrot

    MHCarrot

    Joined:
    Feb 2, 2021
    Posts:
    3
  3. MHCarrot

    MHCarrot

    Joined:
    Feb 2, 2021
    Posts:
    3
    I took a screenshot of Unity Frame Debugger.
    DBuffer is not used in drawing for the 5th and the subsequent terrain layers.

    In fact, in TerrainLitAdd.shader of drawing for the 5th and the subsequent terrain layers (see Case2 in the screenshot),
    DBuffer keyword "#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3" is not declared.

    Since I'm not a graphic programmer, I don't know why the use of DBuffer is not declared in TerrainLitAdd.shader.

    FrameDebuggar_DrawMeshTerrain.png