How can I remove ugly artifact between two textures? [Resolved]

Hi everybody,

I wrote a shader which makes smooth transition between adjacent textures, but here is my problem

[One pixel wide line between textures]

as you can see there is thin line between two textures, pixels of this line have Height equal to _SandHeight, please see my shader below

Shader "Custom/PixelHeightsBlendedTextures"
{
	Properties 
	{
		_WaterHeight ("Water texture layer up to height", float) = 0
		_SandHeight  ("Sand texture layer up to height", float)  = 1
		_GrassHeight ("Grass texture layer up to height", float) = 2
		_RockHeight  ("Rock texture layer up to height", float)  = 3 
	
		_DesertSand ("Desert Sand", 2D) = "white" {}
		_TerrainFloor ("Terrain Floor", 2D) = "white" {} 
		_BlackRock ("Black Rock", 2D) = "white" {} 
		_Snow ("Snow", 2D) = "black" {}
	}
	
	SubShader 
	{
		Tags
		{
			"Queue"="Geometry"
			"IgnoreProjector"="False"
			"RenderType"="Opaque"
		}

		Cull Back
		ZWrite On
		ZTest LEqual
		ColorMask RGBA


		CGPROGRAM
		#pragma surface surf BlinnPhongEditor 
		#pragma target 3.0 
		
		    float _WaterHeight;
			float _SandHeight;
			float _GrassHeight;
			float _RockHeight;				
			float _BlendingWidth;
			
			//sampler2D _Water;
			sampler2D _DesertSand;
			sampler2D _TerrainFloor;
			sampler2D _BlackRock;
			sampler2D _Snow;
			
			struct EditorSurfaceOutput {
				half3 Albedo;
				half3 Normal;
				half3 Emission;
				half3 Gloss;
				half Specular;
				half Alpha;
				half4 Custom;
			};
			
			inline half4 LightingBlinnPhongEditor_PrePass (EditorSurfaceOutput s, half4 light)
			{
				half3 spec = light.a * s.Gloss;
				half4 c;
				c.rgb = (s.Albedo * light.rgb + light.rgb * spec);
				c.a = s.Alpha;
				return c;
			}

			inline half4 LightingBlinnPhongEditor (EditorSurfaceOutput s, half3 lightDir, half3 viewDir, half atten)
			{
				half3 h = normalize (lightDir + viewDir);
				
				half diff = max (0, dot ( lightDir, s.Normal ));
				
				float nh = max (0, dot (s.Normal, h));
				float spec = pow (nh, s.Specular*128.0);
				
				half4 res;
				res.rgb = _LightColor0.rgb * diff;
				res.w = spec * Luminance (_LightColor0.rgb);
				res *= atten * 2.0;

				return LightingBlinnPhongEditor_PrePass( s, res );
			}
			
			struct Input {
				float3 worldPos;
				//float3 worldNormal;
				float2 uv_DesertSand;
				float2 uv_TerrainFloor;
				float2 uv_BlackRock;
				float2 uv_Snow;
			};


			void surf (Input IN, inout EditorSurfaceOutput o) 
			{				
				o.Normal = float3(0.0,0.0,1.0);
				o.Alpha = 1.0;
				o.Albedo = 0.0;
				o.Emission = 0.0;
				o.Gloss = 0.0;
				o.Specular = 0.0;
				o.Custom = 0.0;
								
				// Get height of a pixel
				float Height = IN.worldPos.y; 
				
     			half3 waterColor = half3(0.04, 0.21, 0.54);
				float distance;
															
				if(Height < _WaterHeight)
					o.Albedo = waterColor; 
				else if (Height < _SandHeight)// blend with next texture
				{
					distance = (_SandHeight - Height) / (_SandHeight - _WaterHeight);
					o.Albedo 
						= lerp(tex2D(_TerrainFloor, IN.uv_TerrainFloor.xy), tex2D(_DesertSand, IN.uv_DesertSand.xy), distance);	
				}				
				else if (Height < _GrassHeight)
				{
					distance = (_GrassHeight - Height) / (_GrassHeight - _SandHeight);
					o.Albedo 
						= lerp(tex2D(_BlackRock, IN.uv_BlackRock.xy), tex2D(_TerrainFloor, IN.uv_TerrainFloor.xy), distance);	
				}
				else if (Height < _RockHeight)
				{
					o.Albedo = tex2D(_BlackRock, IN.uv_BlackRock).rgb;
				}
				else
					o.Albedo = tex2D(_Snow, IN.uv_Snow).rgb;

				o.Normal = normalize(o.Normal);
			}
		ENDCG
	}
	
	Fallback "Diffuse"
}

How can I remove this line?

It looks to me like you have anti-aliasing turned on for your terrain geometry. This will cause nasty seams like this.

So I solved this problem by using Triplanar UV mapping