If a pixel shader 3.0 shader falls back to Diffuse, shadows look fine.
If a pixel shader 3.0 shader falls back to a pixel shader 2.0 shader which then falls back to Diffuse, shadows are X-RAY.
Graphics programmers can tell you what’s secretly happening here inside the engine: these objects are no longer contributing to the shadow collector but they are sampling it later. This is exactly how you would set up decal rendering, by the way, but that’s not what’s happening here. In this case Unity just seems massively confused.
TL;DR: Has anyone had success falling back to a pixel shader 2.0 shader?
[30543-fallback+sc+hell.jpg|30543]
I trash Unity a lot, because someone should, but this one was my mistake and I’ll cop to it.
One fallback shader in my chain was not compiling. When this happens Unity gets confused about what’s going on. Specifically:
- The shadow pass totally skips your object
- Thus, it stops casting and receiving shadows
- Color pass still draws; object still “receives shadows” in that it samples the shadow collector and retrieves values, but these values are not correct (X-RAY shadows, exactly what you get when tapping a shadow collector without contributing to it)
So this was my fault, and mildly interesting in that we learned how Unity deals with a broken fallback chain (answer: depth passes stop working, color pass still tries to draw)