I came across an odd behaviour I have a hard time understanding :
I made a foliage shader that needs to cast shadow from a cutout texture.
It works well until I have a second material with the same shader that use another texture.
The shadows now flick from one texture to another.
I believe this is based on the cascaded shadow distance because it seems to change accordingly :
All I could think of was that the SRP batcher sets one texture to use for all material, even if I don’t actually use the _BaseMap from the CBuffer and also that my shader isn’t compatible with SRP batcher…
The shadowcaster pass I use is the one from Unity , I only added this little piece of code to cutout.
(input.uv2 is just the texcoord )
-I don’t see how drawcalls debug would help here, a part from knowing that it actually does increase and decrease from the shadowpass calls ?
-Clipping didn’t change anything,
-Disabling cascaded shadow actually disables one of the textures, so basically all materials cast the shadow of a specific texture that they don’t have a ref to.
The “texture switch” seems to only be there when using 4 cascades, at the most detailed one.
By the way, duplicating the shader per materials that has a different texture does work. so yeah that’s the quick fix for now but duplicating my shader per texture is not the best workflow nor the most optimized so …
sorry for late answer but this issue reminds me a very recent bug. We’re working on a fix to be published soon, but meanwhile you can try a work around: disabling “static batching” may fix this issue. Of course it’s just a work around and you may lose some CPU perf by disabling static batching (depends of your scene )