How can I make a shader that doesn’t render itself if the distance from the camera is greater than something, here is what I have in the subshader for now:
SubShader
{
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest Greater .01
LOD 200
CGPROGRAM
#pragma surface surf Lambert vertex:vert
#include "UnityCG.cginc"
uniform sampler2D _MainTex;
uniform float4 _Wind;
uniform fixed4 _Color;
uniform float _CullDistance;
struct Input {
float2 uv_MainTex;
};
void vert(inout appdata_full v)
{
v.vertex.z += (sin(_Wind.x )/5.0) * v.color.r;
v.vertex.x += (sin(_Wind.y )/5.0) * v.color.r;
}
void surf (Input IN, inout SurfaceOutput o) {
fixed4 difTex = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = difTex.rgb * _Color.rgb;
o.Alpha = difTex.a;
}
ENDCG
}