I recently upgraded from LWRP 4.x to 5.x, and would like to put down some quick notes here, hope it helps people trying to make the jump from 2018 to 2019.
Things that will break:
(A) Anything using 4.x-preview or 5.x-preview API: IBeforeCameraRender? IBeforeRender? All gone.
-
Instead of you create custom ForwardRendererData assets, which defines custom render passes. They allow you to inject extra passes, at specific render stage, to specific layer, without writing extra C# code. (of course you still need to write the shader pass, but luckily there is Shader Graph).
-
Any doc on this? Nope. but there are videos, and more videos.
(B) Custom LWRP shaders not based on Shader Graphs are likely broken.
-
Luckily they are relatively easy to fix, shader compiler tells you where trivial errors took place. Repeat definition of _ShadowBias appears to be the most common for me; any code that directly read from LWRP built-in shader variables, like unity_4LightIndices0, will also break.
-
Does changelog tell you exactly which variables replace which? Not always. These variables are often changed more than once during 5.x, and changelog will lose track of them. unity_4LightIndices0 is now
unity_LightIndices[0] by the way.
(C) Custom ShaderGraph integration will break.
-
Because both its Public API and custom node API are now gone.
-
There is no easy workaround for this one. But as a last resort, you could still export SG shaders in to plain shaders, and fix them like you did in (B).
-
Alternatively, rebuilding your graph use third-party tool like ASE, which supports LWRP 5.x too.
(D) Post Processing Stack are still a bit broken.
-
Small issues like Post Processing Debug view doesn’t output to game view continue to annoy me.
-
But this wasn’t working in 4.x neither, so can’t really blame 5.x for breaking them.
That’s about it for me.
It’s quite obvious Unity SRP are moving towards “less glue code” by providing in Editor convenience, where you worry less about things like “how to inject a pass”, and focus more on “what this pass will do”.
This is great news for faster iteration.
But knowing the inner workings of SRP is still relevant, my knowledge of LWRP shader library definitely made my upgrade easier.
If you happen to know other things that will be break between 4.x and 5.x, reply to let people know.
Thx for reading!