Question by 
               carlosrcp · Sep 10, 2016 at 12:15 AM · 
                shadershadowvertexshader writing  
              
 
              Shadows in a shader with vertex modifier
How can i have correct shadows in an mesh with vertices deslocated by the shader? The shadows appear like the mesh wasn't changed.
I'm using this shader:
   Shader "Example/Normal Extrusion" {
         Properties {
           _MainTex ("Texture", 2D) = "white" {}
           _Amount ("Extrusion Amount", Range(-1,1)) = 0.5
         }
         SubShader {
           Tags { "RenderType" = "Opaque" }
           CGPROGRAM
           #pragma surface surf Lambert vertex:vert
           struct Input {
               float2 uv_MainTex;
           };
           float _Amount;
           void vert (inout appdata_full v) {
               v.vertex.xyz += v.normal * _Amount;
           }
           sampler2D _MainTex;
           void surf (Input IN, inout SurfaceOutput o) {
               o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
           }
           ENDCG
         } 
         Fallback "Diffuse"
       }
 
               found here https://docs.unity3d.com/Manual/SL-SurfaceShaderExamples.html.
               Comment
              
 
               
              Answer by Namey5 · Sep 10, 2016 at 12:26 AM
You have to add the 'addshadow' keyword to the surface declaration, i.e.
 #pragma surface surf Lambert vertex:vert addshadow
 
              thanks, this works, but when try to move only some vertices, using: if(v.vertex.y>0.5f) v.vertex.xyz += v.normal * _Amount;
it doesn't work, what i'm really trying to do is to deform just some vertices, what can i do?
Which doesn't work, the shadows or the vertex displacement?
the shadows, the vertex deforms but the shadows stay the same
I know this is from two years ago but thank you very much
Your answer