Hi guys, I’ve a problem with my Shader and I can’t to fix it. My shader make a lerp compared to the vertex position (if a vertex is above the origin, it make lerp for example). My problem is that my shader doesn’t get the shadows and I don’t know what to do that.
Someone can help me?
Thank you in advance to anyone who helps me to fix it.
I give you my shader for so you can watch :
Shader "Custom/TerrainColoring Normals"
{
Properties
{
_Color1("Down Color", Color) = (1, 1, 1, 1)
_Color2("Top Color", Color) = (1, 1, 1, 1)
_Depth ("Depth", Float) = 10
}
SubShader
{
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
float4 _Color1;
float4 _Color2;
float _Depth;
struct v2f
{
float4 pos : SV_POSITION;
float3 color : COLOR0;
};
v2f vert (appdata_base v)
{
v2f o;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.color = o.color = lerp(_Color1, _Color2, (v.vertex.y+_Depth*0.5) / _Depth);
return o;
}
half4 frag (v2f i) : COLOR
{
return half4 (i.color, 1);
}
ENDCG
}
}
Fallback "VertexLit"
}