GLTFUtility
GLTFUtility copied to clipboard
[URP] Shader improvements
Hi Siccity,
Thanks for this great tool.
I started by improving the ShaderGraphs shaders to be feature complete and fixed some issues (see commit messages). You should be able to merge the first two commits as is.
After completing that, I found out the performance of those shaders is subpar, so I also modified the URP Lit shader to better support the glTF spec. I changed the MetalRough, Occlusion and SpecGloss texture maps to the following: Metallic (B), Roughness (1.0f - G), Occlusion (R). Specular setup: Specular (RGB), Gloss (A). Occlusion (R) The rest of the shader is the same and references the URP 'library' files directly.
I also added a helper class to setup the correct keywords depending on active textures, colors and modes. This is almost just a copy of BaseShaderGUI.cs (which is not available at runtime) from the URP package.
I changed the default URP ShaderSettings to use this modified Lit shader instead of the ShaderGraph shaders.
My main concern with this approach is cross-version support with different URP package versions. This Lit.shader and LitInput.hlsl was copied from URP 7.3.1 (Unity 2019.4.8f1). One solution could be to have separate shaders for each URP version with breaking changes.
@Siccity What do you think of these improvements?