Skip to content

[URP] Shader improvements#118

Open
Kibsgaard wants to merge 6 commits into
Siccity:masterfrom
Kibsgaard:fix/URP
Open

[URP] Shader improvements#118
Kibsgaard wants to merge 6 commits into
Siccity:masterfrom
Kibsgaard:fix/URP

Conversation

@Kibsgaard

Copy link
Copy Markdown
Contributor

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.

@marcusx2

Copy link
Copy Markdown

@Siccity What do you think of these improvements?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants