Search Unity

Question Why would a material have both WRITE_DECAL_BUFFER and DISABLE_DECALS?

Discussion in 'High Definition Render Pipeline' started by alexandre-fiset, Jan 17, 2023.

  1. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    We have some mesh terrain tiles that appear in the Depth Prepass in the frame debugger, but we would love them not to render twice like that.

    The problem is, even if we disable decals on them, they still appear in the Frame Debugger DepthPrepass. As shown below, both the write and disable keywords appear in the keywords list.

    Any idea what can force a material to be rendered on the decal buffer?

    upload_2023-1-17_13-42-1.png
     
  2. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    Answering to myself here: It seems like turning off Depth Prepass Within Deferred solves the issue.

    In that regard, the docs are misleading: "If you enable Decals then HDRP forces a depth prepass and you can not disable this feature". This is not true. If we disable this frame setting, decals are still working, but only the materials with "receive decals" toggled on appear drawn in the Deffered Prepass section of the Frame Debugger.
     
  3. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    324
    The way I interpret what the documentation says there, I don't think it is incorrect... it is saying that you cannot totally disable/avoid a depth prepass if you enable Decals, because it will force one for those materials with receive decals. So if you wish to completely avoid it, you must ensure that the Depth Prepass checkbox is off, AND that you don't use decals.
     
  4. sqallpl

    sqallpl

    Joined:
    Oct 22, 2013
    Posts:
    384
    I was trying to set it up this way (Depth Prepass disabled, Decals enabled) but It causes some problems with motion vectors (HDRP 12.1.5).

    Here is my thread with questions about Depth Prepass and Decals where I was testing these settings. Unfortunately there are no answers.

    https://forum.unity.com/threads/depth-prepass-with-deferred-questions-decals-motion-vectors.1356185/

    There is some problem with motion vectors on meshes that use materials with 'receive decals' disabled when Depth Prepass option is disabled in settings.

    Maybe the "Depth Prepass" toggle should be greyed out and enabled by default when Decals are enabled (just as in the documentation) because it looks like there is something wrong going on when depth prepass is disabled while decals are enabled.
     
    Last edited: Jan 19, 2023