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 Custom Passes and buffer access

Discussion in 'High Definition Render Pipeline' started by H-Alex, Mar 9, 2020.

  1. H-Alex

    H-Alex

    Joined:
    Oct 2, 2012
    Posts:
    26
    Hello everyone,

    I've been messing around with Custom Passes to achieve stylized effects for a game we're working on, and I have a bunch of questions for the community and definitely need your help to understand some concepts. I'm using shader graph to create the override shaders.

    1. First of all, more a remark than anything else. I spent some time figuring out why my shader graph custom pass wasn't working. I followed the HDRP doc and it took me while to see that only the Unlit Master node works, and Unlit (HDRP) Master doesn't. Any more info of the reason why is welcome, but that's not my main question here :)

    2. I couldn't find a way to chain custom passes. Right now I'm using DrawRenderersCustomPasses, Before Post Process. I had to make a uber shader and couldn't split into two consecutive Custom Passes. My effect is based of HD Scene Color, and Scene Depth, and writes into Unlit Master / Color.
    3. I'd like to improve my effect by using the lighting buffer. Is is stored in the gbuffer? how can we access it from a custom node?

    4. The effect I'm trying to achieve relies on multiple sampling of the depth buffer, and I found it easier to do (and read) using a custom node that is doing its own thing. However I stumbled upon an issue where I couldn't call SHADERGRAPH_SAMPLE_SCENE_DEPTH(...) from my custom node code. I tricked the system by adding a dummy Scene Depth node in my graph temporarily. What's the proper way to do it? Am I missing a define / using etc? I couldn't find the proper syntax.

    5. Kind of related to 3. and 4., I couldn't find how to get Depth Normals buffer, and the Color buffer (HD Scene Color).

    6. Is there a fundamental difference between a FullScreenCustomPass and a CustomPostProcess?

    7. Is it possible to use a shader graph along with a FullScreenCustomPass?

    8. I'd like to alter the Lighting data before it is composited. Is there any way to plug in some effects in between the Deferred Lighting stage and the Forward Opaque stage to make that happen (in case it is actually in between these two where I need to do my stuff to achieve such effect)?
    Big thumbs up to anyone able to help me on that.
    And thank you to the HDRP team, amazing stuff! :)
     
    Last edited: Mar 12, 2020
  2. Albarnie

    Albarnie

    Joined:
    Oct 24, 2015
    Posts:
    18
    Hey there, would just like to bump and ask if you managed to find a fix for the depth texture thing? I have added a scene depth node but my SHADERGRAPH_SAMPLE_SCENE_DEPTH inside a custom function node still always returns 0. for context I am trying to make a multi sample edge detection shader.
     
  3. H-Alex

    H-Alex

    Joined:
    Oct 2, 2012
    Posts:
    26
    It has to be IN the graph, meaning, linked to something. And not on it's own because it gets stripped from the shader.

    Is it the case?