I’m trying to make a fence with a transparent shader, shader code below. However it’s causing these weird artifacts as you look in the distance. Specifically, the vertical lines on the texture at fixed distances from the camera. They move as the camera moves and are quite offputting.
Shader "GameSpef/Unlit With Alpha" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
_Colour("Colour",Color) = (1,1,1,1)
}
SubShader {
Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }
CGPROGRAM
#pragma surface surf NoLighting alpha
sampler2D _MainTex;
half4 _Colour;
half4 LightingNoLighting(SurfaceOutput o, half3 viewDir, half atten) {
half4 c;
c.rgb = o.Albedo;
c.a = o.Alpha;
return c;
}
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D(_MainTex,IN.uv_MainTex);
o.Albedo = c.rgb * _Colour;
o.Alpha = c.a;
}
ENDCG
}
}
Any ideas on how this could be improved? This is on a mobile device if it helps.