Hey there, hope anyone can help… Ive written this surface shader to give my trees some movement and I thought creating a cutout shader would be simple enough however I’m getting a really weird issue which I know has something to do with shadowcaster and the way I’m using it but I’m stump at how to move forwards.
This is the shader:
Shader "Nature/FoliageMovement" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness("Smoothness", Range(0,1)) = 0.5
_Metallic("Metallic", Range(0,1)) = 0.0
_Speed("Speed",float) = 50
_Offset("Offset",vector) = (0,0,0,0)
_CutOff("CutOff", float) = 1
}
SubShader{
Tags
{
"IgnoreProjector" = "True"
"Queue" = "AlphaTest"
"RenderType" = "TransparentCutout"
"LightMode" = "ShadowCaster"
}
LOD 200
Cull Off
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows vertex:vert alphatest:_CutOff
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
float _Speed;
float4 _Offset;
struct Input {
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
void vert (inout appdata_full v)
{
_Offset = fixed4(clamp(_Offset.x,-0.25, 0.25)/100, _Offset.y/100, clamp(_Offset.z,-0.25, 0.25)/100,_Offset.w/100);
//Top
v.vertex.x += v.color.g * sin(_Time * _Speed) * _Offset.x;
v.vertex.z += v.color.g * sin(_Time * _Speed) * _Offset.z;
//Base
v.vertex.x += v.color.r * 0;
v.vertex.z += v.color.r * 0;
v.vertex.y += v.color.r * 0;
v.vertex.w += v.color.r * 0;
v.vertex.y += (v.color.g * sin(_Time * _Speed)* mul(unity_WorldToObject, v.vertex)*_Offset.y);
float bounce = v.color.g * sin(_Time * _Speed) *_Offset.w;
v.vertex.y += bounce;
}
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Transparent/Cutout/Diffuse"
}
The is what I’m seeing in editor
But weirdly by selecting the model I get the desired result however this is only temporary and doesn’t show in a build ![]()

Any help would be greatly appreciated and thanks in advance ![]()
