Zallist / unity.zallist.universal-simple-lit-shadergraph-target

This plugin simply adds a Simple Lit material (SubTarget) to the Universal target for Shader Graph for URP
Other
85 stars 14 forks source link

Shaders are broken in builds with Unity 2021.3.27/URP 12.1.12 #22

Closed CustomPhase closed 1 year ago

CustomPhase commented 1 year ago

Editor: image

Build: image

It worked fine on 12.1.10, but on 12.1.12 or 12.1.11 its broken. Tried reimport all/removing Library - didnt help. Cant even roll back URP to 12.1.10, since it seems to be removed: image

Zallist commented 1 year ago

Well that's annoying. I'm assuming that rolling back unity itself to an earlier 2021.3.x would also fix it since that would give you access to the earlier urp.

Zallist commented 1 year ago

Looks like the last version that used urp 12.1.10 was 2021.3.22f1, since they updated the package in 23.

https://unity.com/releases/editor/whats-new/2021.3.23

Changelog for urp https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.1/changelog/CHANGELOG.html

Zallist commented 1 year ago

I can't see any relevant changes in the urp codebase. Is it only objects that use the simple lit target that get screwed up in build? Try adding one with a lit base and see if it's messed up in the same way. And maybe a non ShaderGraph version of simple lit. It almost looks like a full screen pass is screwing up and could be related to fog.

CustomPhase commented 1 year ago

Thanks for the quick response!

Looks like the last version that used urp 12.1.10 was 2021.3.22f1, since they updated the package in 23.

https://unity.com/releases/editor/whats-new/2021.3.23

Changelog for urp https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.1/changelog/CHANGELOG.html

Hm, i see. Ill downgrade the Unity version to .22 and try using 12.1.10. But also sorry, i was mistaken a bit - the version the package worked correctly in builds was 12.1.7. We had to upgrade because in 12.1.7 decals were broken with resolution scaling. They fixed it in 12.1.8:

Fixed render scale correctly work with screen size property. This includes decals.

Is it only objects that use the simple lit target that get screwed up in build?

Yes. Not related to the fog or anything else.

CustomPhase commented 1 year ago

Nevermind. Sorry, it wasnt related to your package at all. I mistakenly thought that it was related to this package because we had one object in the scene that wasnt using Simple Lit and it rendered correctly. But after replacing some materials with Lit shadergraphs, and some with regular Lit shader, it still was broken.

And even then things got weirder - materials with default URP Lit shader were rendering fine only if they had an Albedo texture assigned, but if they didnt - they would simply output their screen coordinates as pure color. I assume it was erroneously using some Debug variant or something.

Anyway, we updated all the way to Unity 2022.3, and that resolved all the issues. Thanks for the help!

UPD: Just finished building a build with Unity 2021.3.27 + URP 12.1.12 but with stripping disabled - that fixed the issue as well. So it looks like stripping is busted in these Unity/URP versions.

Zallist commented 1 year ago

Doesn't surprise me. I did see some stripping logic changes in their various commits on their Graphics repo, but was 99% sure that if it affected this ShaderGraph it would also affect all the built in ones. And I guess I was right.