a tiny and flexible surface shader solution for Unity URP
A tiny and flexible "surface shader" solution for Unity URP. A more ideal solution here: https://github.com/slipster216/UnityModularShaderPrototype
Since URP doesn't support surface shader anymore, if shader graph alone can't fulfill all your needs and writing raw vert/frag lit shader supporting all light & shadow in URP is just too much work, try download this project, and start writing your own "surface shader" in URP.
"Surface shader" makes shader development much easier and faster in URP, because user don't need to know/learn/write lighting related concrete code at all. User only need to write the surface function, then select a good looking lighting function(edit 1 line of code in shader), that's all the work to produce a lit shader.
left sphere = our "surface shader" with:
right sphere = default URP PBR lit shader
struct UserGeometryOutputData
{
float3 positionOS;
float3 normalOS;
float4 tangentOS;
};
struct UserSurfaceOutputData
{
half3 albedo;
half3 normalTS;
half3 emission;
half metallic;
half smoothness;
half occlusion;
half alpha;
half alphaClipThreshold;
};
It is a very early WIP project and will change a lot, but I need to finish this in order to build more complex toon shaders on top of this project. This project will be pure .shader/.hlsl, to see how far we can reach without C# codegen. If you are interested in this "surface shader" concept, you can clone it, try writing your own surface shader functions, see if the current "surface shader" design can fulfill your shader development needs.
You can send me suggestions/bug report, or open discussion/just chat in Issues tab, or even send pull requests are very welcome!