How to make this simple vertex shader receive shadows

I got the following shader code:

Shader " Vertex Colored 2" {
Properties {
_Color (“Main Color”, Color) = (1,1,1,1)
_MainTex (“Base (RGB)”, 2D) = “white” {}
}

SubShader {
Pass {
ColorMaterial AmbientAndDiffuse
SetTexture [_MainTex] {
Combine texture * primary, texture * primary
}
SetTexture [_MainTex] {
constantColor [_Color]
Combine previous * constant DOUBLE, previous * constant
}
}
}

Fallback " VertexLit", 1
}

Wich does exactly what I want. Except the fact that it does not receive any shadows. I have very little experience with shaders, is there any simple solution too this?

Fallback " VertexLit", 1

Remove the space character from " VertexLit". The “, 1” syntax is also to new and I couldn’t find any documentation about it.

I think using this following line should give you shadows back, because the VertexLit shader provides a shadow pass.

Fallback "VertexLit"

I tried the VertexLit shader and it does not recive any shadow, at least not for me.

Also, I dont think the “Fallback” have anything to do with it. The shader runs fine on my hardware.

But thanks anyway :slight_smile:

I found another shader, wich alsmot solved the problem. The problem now is that I dont want the diffuse lightning. Only the shadows, anyone? :slight_smile:

Shader "Custom/Vertex Colored Diffuse" {
Properties {
    _Color ("Main Color", Color) = (1,1,1,1)
    _MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
    Tags { "RenderType"="Opaque" }
    LOD 150
CGPROGRAM
#pragma surface surf Lambert vertex:vert
sampler2D _MainTex;
fixed4 _Color;
struct Input {
    float2 uv_MainTex;
    float3 vertColor;
};
void vert (inout appdata_full v, out Input o) {
    UNITY_INITIALIZE_OUTPUT(Input, o);
    o.vertColor = v.color;
}
void surf (Input IN, inout SurfaceOutput o) {
    fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
    o.Albedo = c.rgb * IN.vertColor;
    o.Alpha = c.a;
}
ENDCG
}
Fallback "Diffuse"
}