Search Unity

Feature Request Pass Management

Discussion in 'Shader Graph' started by The-White-Guardian, Dec 22, 2019.

  1. The-White-Guardian

    The-White-Guardian

    Joined:
    May 16, 2019
    Posts:
    4
    Hi all,
    Currently there are a few areas in which I think Shader Graph could use some more versatility, and all of these are focused around shader passes.

    Currently it does not seem to be possible to control explicitly which passes are and aren't included in a compiled shader. For example, if I wanted to remove the shadow caster pass of an emissive object, I would have to copy the generated code into a .shader file and then remove the shadow pass by hand, which somewhat defeats the purpose of node-based shader creation.

    Secondly, it seems impossible to define custom pragma definitions, for example pragma's that expose a shader to the lighting data. For example, an URP unlit graph cannot access lighting data without once again copying the code to a file and then adding the pragmas by hand, which ultimately defeats the purpose of adding custom lighting systems.

    Furthermore, I feel that stuff such as a normals texture are missing in URP. This is an URP issue of course but this is something that one can fix by adding a custom pipeline feature. And there is where Shader Graph comes in: such a feature (if I understand correctly) would require an additional shader pass instructing the GPU what normals data to write to each pixel (world-space surface normal? World-space normal map data? Procedural normal map data?) which currently can't be added through Shader Graph.

    And lastly, currently Shader Graph does not appear to have support for splitting a shader into several distinct passes, each with a unique LOD level, for tailoring shader quality to hardware capabilities or for excluding complex computations when the distance of the rendered object means that the contribution to the final render is negligible.

    My proposal would kill all of these birds with one stone: the addition of a 'Pass Collection', and besides directly creating shaders, having the ability to instead create a 'shader draft'.

    These shader drafts would be your regular straightforward plug-and-play node system that we are all familiar with by this point, but with the addition of being able to define LOD values, custom pragma directives and excluding builtin render passes (or even better, overriding them to allow for things such as transparent shadows) or adding custom passes for things such as custom rendering pipeline steps.

    Each of these shader drafts, themselves saved as an asset, can then be loaded into the pass collection which, when compiled, injects all of these defined shader passes into the final shader asset.

    I'm an utter ignoramus however when it comes to how either Shader Graph or URP work under the hood, so I have no idea if I've just requested the equivalent of a lunar base. I therefore would love to hear feedback on this proposal so that we may work together towards making Shader Graph the ultimate shader creation tool that it is rapidly becoming and deserves to be.

    Cheers, and happy holidays!