Search Unity

Question Shader Graph and HDRP renderqueue/zwriting

Discussion in 'Shader Graph' started by H-Alex, Jun 6, 2019.

  1. H-Alex

    H-Alex

    Joined:
    Oct 2, 2012
    Posts:
    26
    Hello to the community,

    I'm playing with HDRP and prototyping a few things for an upcoming project, and trying out shader graph to build custom effects.

    I used to code shaders in the legacy pipeline and was able to control whether a shader would write to the depth buffer or not, and also play around with the render queue to achieve different fun stuff.

    I cannot find a way to do that using the HDRP.
    How am I supposed to work with drawing some shaders before some others? I'd have expected in the Lit Master node to be able to create custom Rendering Passes and check/uncheck a zwrite enabled flag or something.

    Basically right now I'm trying to get data out of the Scene Depth node, and would like that my shape is not written to the depth buffer prior to the shader execution.

    - Is it written in a depth pre-pass?
    - What is the Depth Prepass Within Deferred parameter in the pipeline asset used for? as it doesn't seem to change anything to my 'issue'

    Bonus: is there an equivalent in HDPR of the LWRP Custom Forward Renderer asset? or any way to work out the rendering order and create post processing effects?

    Thank you for you answers,
    Alex
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,342
    Yeah ... nope. Not supported by Shader Graph (yet). No known ETA on when support for this kind of thing will be added either, but it's a known want and is supposedly on their list to get to.

    The only thing you can do is change between Opaque and Transparent, which changes between ZWrite On/Off and Queue 2000/3000. You can still override the queue on the material.

    AFAIK stuff works just like the built in rendering paths. The Scene Depth node is sampling from the Camera Depth Texture, which for LWRP is generated as a pre-pass. HDRP I'm not sure if it's generated from the optional pre-pass or from the final gbuffer, but I'm guessing it's from the final gbuffer. My understanding is the HDRP's depth pre-pass is an optimization step for scenes with a lot of alpha tested geometry.

    Basically, if you change your object to be transparent, it won't write to the depth texture used by the Scene Depth node. Otherwise it will. You can try overriding the queue on the material directly to make an opaque object that can sample the scene depth, but that limits how you can use that data.
     
  3. H-Alex

    H-Alex

    Joined:
    Oct 2, 2012
    Posts:
    26
    Thanks for answering.
    Ok that's what I thought.

    From my understanding of the doc and my tests, it seems like there is a prepass when decals are enabled.
    If anyone can confirm and maybe add details, that'd be appreciated.

    Also appreciated if someone can come with an answer to the 2 bonus questions :
    • is there an equivalent in HDPR of the LWRP Custom Forward Renderer asset?
    • is there any way to create post processing effects with the HDRP?
    Thanks guys