Directional lights can't cast shadows onto Standard Surface Shaders, only inside VRchat

I made a thread about this issue earlier, but I’ve since narrowed it down to a very specific and reproducible problem, so I thought I’d make a new thread that cuts to the chase:

I have a scene with:

  • a realtime directional light
  • a realtime point light
  • a cube whose material is Default-Material
  • a cube whose material uses a brand-new, UNTOUCHED Standard Surface Shader
  • a floor whose material is Default-Material
  • a capsule whose material is Default-Material, to cast a shadow on the previous three

In the editor, everything looks normal.

If I produce a standalone Windows build of this scene (after deleting the VRChat SDK), everything looks normal.

If I load the scene into VRChat, the cube that is lit by the (completely default) Standard Surface Shader can receive shadows from the point light, but not from the directional light:

Even weirder, it you can see the directional light’s shadow THROUGH it?? (I promise the shader is opaque!)

As a footnote: the point light is not necessary to reproduce this bug; the same thing happens if the only light in the scene is the directional light. I just included the point light to show that the cube will catch some shadows but not others.

Has anyone encountered anything like this? I can provide my project files if necessary. Is this something that should be filed as a VRchat bug? (Again: in a standalone build, this doesn’t happen.)

Good news – I’ve finally stumbled onto a very simple workaround. If you just add “addshadow” to the end of the first #pragma line, then it will finally behave the same in VRchat as it does in the editor and standalone builds.

Trivial to do once you know it, but hopefully this can save someone else the days of experimenting that it took me…