Shadows appear in the Unity scene view but not in world testing

Hi everyone, I’m working on my first VRChat world and have run into a problem, where the custom shaders I’m using cast and accept shadows just fine in the Unity scene view, but don’t in the VRC world. I’ve included screenshots to explain this in more detail.
I have to use custom shaders on the whole world because the main model’s colour data is stored in vertex colour, which the default Unity shader doesn’t support.

The custom shader code (from https://forum.unity.com/threads/finding-and-using-a-vertex-colors-shader.236366/):

Shader "DAB/Vertex Detail Specular"
{
  Properties
  {
      _Color ("Main Color", Color) = (1,1,1,1)
      _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
      _Shininess ("Shininess", Range (0.01, 1)) = 0.078125
      //_MainTex ("Base (RGB)", 2D) = "white" {}
      _Detail ("Detail (RGB) Gloss (A)", 2D) = "gray" {}
  }
 
  SubShader
  {
      Tags { "RenderType"="Opaque" }
      LOD 300
   
    CGPROGRAM
    #pragma surface surf BlinnPhong vertex:vert
    //#pragma surface surf BlinnPhong
    //#pragma surface surf Lambert
 
    //sampler2D _MainTex;
    sampler2D _Detail;
    float4 _Color;
    float _Shininess;
 
    struct Input
    {
        //float2 uv2_MainTex;
        float2 uv_Detail;
        float3 vertColors;
    };
 
    void vert(inout appdata_full v, out Input o)
    {
      o.vertColors= v.color.rgb;    // grab vertex colors from appdata
      o.uv_Detail = v.texcoord;   // maybe need this
 
    }
 
 
    void surf (Input IN, inout SurfaceOutput o)
    {
        //half4 c = tex2D(_MainTex, IN.uv2_MainTex) * _Color;
        half3 c = IN.vertColors.rgb * _Color.rgb;               //half3 check to see that alpha works
        c.rgb *= tex2D(_Detail,IN.uv_Detail).rgb*2;
        o.Albedo = c.rgb;
        o.Gloss = tex2D(_Detail,IN.uv_Detail).a;
        //o.Alpha = c.a * _Color.a;
        o.Specular = _Shininess;
        //o.Normal = UnpackNormal(tex2D(_Detail, IN.uv_Detail));
    }
    ENDCG
  }
 
  Fallback "Specular"
}
 

The Unity scene view (note the clearly visible shadows on the main object, also note that I’ve only applied the custom shader to this object and a few surrounding ones, the floor and the building in the background still have default textures):

The same object ingame, mysteriously without shadows:

I’ll also note that the shader generates this weird transparent effect where you can see the shadows of objects behind it that have the default shader, which you can see more clearly in this screenshot (again, this doesn’t happen in the Unity game view):

I’m not sure what’s going on. This is the second vertex colour shader I have found online, but neither cast or accept shadows. Any help is greatly appreciated.

This is caused by a Unity/VRC bug where the Unity base fallback shaders can’t be used. It means the shader doesn’t have a working shadowcaster pass, which means it won’t render in the depth buffer or the shadow pass. In this case, the shader doesn’t have the addshadow directive so it doesn’t generate a shadowcaster pass. That would normally be fine, but it specifies that it falls back to Specular, which falls back to VertexLit, which is broken.

You can work around this by changing
Fallback "Specular"
to
Fallback "Standard"

This will change the fallback to Standard, which will cast a shadow because Standard’s shadowcaster works.

Thank you, this worked!