Search Unity

Question HDRP10 + DepthOnly Pass + Smoothness?

Discussion in 'High Definition Render Pipeline' started by BOXOPHOBIC, Jul 30, 2021.

  1. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    509
    Hello,

    Following some discussions with some other developers, we noticed something interesting and I'm hoping somebody could explain this:

    1. I created a basic shader with SG and hooked some heavy noises to the Smoothness


    2. I copied the code to a new shader and stripped out everything except the DepthOnly pass. Here I noticed that the Smoothness is calculated:
    upload_2021-7-30_9-32-50.png

    3. When Compile and Show Code, I can see all that code calculated with some keywords in the PS.



    Is this correct/expected? I attached the shader just in case.

    Thank you!
     

    Attached Files:

  2. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    509
    Just a follow-up with URP 10:

    1. The same shader used, the heavy noise is linked to the Smoothness port:
    upload_2021-8-3_17-7-12.png

    2. I copied the code to a new shader and stripped out everything except the DepthOnly pass. Here I noticed that the Smoothness is not calculated:
    upload_2021-8-3_17-7-59.png

    3. When Compile and Show Code, it looks as expected:
    upload_2021-8-3_17-8-58.png

    Shader attached. Thanks you!
     

    Attached Files:

  3. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    For our project, we use HDRP and Deferred shading. Since we use a lot of vegetation and heavy shaders, we enabled the depth pass for early z rejection explicitly.
    I expect the pixel shaders to be as simple as possible (writing the z output considering the alpha clip values), but instead a ton of unexpected instructions are generated as the OP explained.
    Please advise!
     
  4. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    509
    Furthur checking the HDRP shader in Render Doc, this is what I get:

    upload_2021-8-3_18-47-9.png

    HDRP Settings + DX 11:
    upload_2021-8-3_18-48-15.png

    Frame Settings:
    upload_2021-8-3_18-48-48.png

    Frame Debugger:
    upload_2021-8-3_18-50-58.png

    I attached the full shader.
     

    Attached Files:

    Last edited: Aug 3, 2021