A problem we run into quite a lot is that we want to do essentially the same thing as a builtin shader - often URP lit - but with a slight modification. Often the modification is very small - the last one was 5 or 6 lines of code.
This ends up being very clunky to do, as there’s no entry point for anything like that. Our go-to solution has been to copy the shader we want to use, and make the modifications there, but that ends up being hard to keep track of, especially if we do Unity version upgrades and have to port our modifications over to the new shader.
Do you have any advice for how to deal with this situation? Is there anything in the pipeline that might help?
With SRPs, the currently recommended way to customize shaders is via Shader Graph. Of course, this is only possible when customizing the “higher level” description of the shader target (such as the Surface inputs).
To fully customize shaders via text, or modify the innards of the shader, you currently need to modify the ShaderLab and shader includes as you describe.
This will provide a text-based workflow, conceptually similar to legacy Surface Shaders (Built In Render Pipeline). We will provide “templates” for the SRP shaders, which correspond to the inner implementation (subshader, passes…). These templates would be modular, and could be modified and extended more easily.
You may also look at the templates we recently released as part of the Production Ready Shaders.
The URP Lit Shader Graph template allows you to customize it.
I questioned this before - it is hard to understand how shader graph was built without considering how to create a lit shader with a few differences, rather than something completely from scratch!
but I hope the templates have resolved this when I get back to shaders