Search Unity

Feature Request Disable certain nodes for specific passes

Discussion in 'Shader Graph' started by spaceemotion, Feb 2, 2020.

  1. spaceemotion

    spaceemotion

    Joined:
    Sep 29, 2015
    Posts:
    95
    Is there a way to run certain nodes just for specific passes? I would love to have dithered near fading that does not affect the shadowmap.


    (the shadow is being cut off by the dithering here, the wall should be straight)
     
  2. alexandral_unity

    alexandral_unity

    Unity Technologies

    Joined:
    Jun 18, 2018
    Posts:
    163
    Custom multi-pass support is not currently available in Shader Graph. It's on our feature request list and hopefully can be added at some point in the future.
     
    spaceemotion likes this.
  3. spaceemotion

    spaceemotion

    Joined:
    Sep 29, 2015
    Posts:
    95
    what if i rewrite the nodes as custom functions? is there a define or something that can be used?
     
  4. alexandral_unity

    alexandral_unity

    Unity Technologies

    Joined:
    Jun 18, 2018
    Posts:
    163
    If you check the generated shader from the master node, most of the passes have defines like "SHADERPASS_SHADOWS" etc. You should be able to ifguard those.
     
    spaceemotion likes this.
  5. spaceemotion

    spaceemotion

    Joined:
    Sep 29, 2015
    Posts:
    95
    Okay, so the following works:

    upload_2020-2-3_22-57-3.png

    I've changed the thread title to "Feature Request" nonetheless.

    Code (CSharp):
    1. #ifdef SHADERPASS_SHADOWCASTER
    2. IsShadowPass = true;
    3. #else
    4. IsShadowPass = false;
    5. #endif
     
  6. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    Except that does not work in 2020.3.26f1 HDRP 10.8 Deferred, it always returns true :/