Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question Custom RandomWrite Buffer only works with decals disabled

Discussion in 'High Definition Render Pipeline' started by Arycama, Mar 1, 2020.

  1. Arycama

    Arycama

    Joined:
    May 25, 2014
    Posts:
    185
    I have a Virtual Texturing Terrain system working in the legacy rendering pipeline, which involves using Graphics.SetRandomWriteTargets during Update, outputting VirtualTexture requests to a RWBuffer during terrain rendering, and then asynchronously reading the data back to the CPU.

    The system was behaving strangely after porting my shader to HDRP. It would only work correctly around terrain where holes existed.

    I have now discovered that disabling decal support in my HDRP Asset makes the system work correctly again in all situations.

    Does anyone know what might be causing this, and how I could make my system work with decals?
    I assume this might be due to decals using RWBuffers, Clearing RandomWrite targets, or possibly something to do with a depth prepass.

    Thanks for any help.
     
  2. Arycama

    Arycama

    Joined:
    May 25, 2014
    Posts:
    185
    I'm pretty sure this is due to the Depth Prepass somehow.. commenting out
    #define SHADERPASS SHADERPASS_DEPTH_ONLY
    Fixes the issue, but obviously breaks compatibility with decals.

    Is there a reason why my regular shader pass wouldn't get executed after depth only rendering?