Blending texture array in shader without textures between.

Hello.
I have texture2d array that has for example just colours (red, green, blue), and when i use it i want to blend just texture 1 and 3 but shader cannot do that because interpolation in UVs? I use it by SetUVS and just set texture index in 3rd uv value, then in shader get it.

Shader "Custom/Tex2DArray" {
	Properties {
		_Color ("Color", Color) = (1,1,1,1)
		_MainTex ("Albedo (RGB)", 2DArray) = "white" {}
		_MainTex2 ("Albedo (RGB)", 2D) = "white" {}
		_Glossiness ("Smoothness", Range(0,1)) = 0.5
		_Metallic ("Metallic", Range(0,1)) = 0.0
		_SliceRange("Slices", Range(1,24)) = 1
		_UVScale("uv scale", Float) = 1.0
	}
	SubShader {
		Tags { "RenderType"="Opaque" }
		LOD 200
		Pass{
			CGPROGRAM

			#pragma vertex vert
			#pragma fragment frag
			#pragma multi_compile_fog
			#pragma target 3.5

			#include "UnityCG.cginc"

			struct appdata{
				float4 vertex : POSITION;
				float3 uv : TEXCOORD2;
			};

			struct v2f
			{
				float3 uv : TEXCOORD2;
				UNITY_FOG_COORDS(1)
				float4 vertex : SV_POSITION;
			};
		
			UNITY_DECLARE_TEX2DARRAY (_MainTex);
			sampler2D _MainTex2;
			float4 _MainTex2_ST;
			half _Glossiness;
			half _Metallic;
			fixed4 _Color;
			float _SliceRange;
			float _UVScale;

			v2f vert (appdata v)
			{
				v2f o;
				o.vertex = UnityObjectToClipPos(v.vertex);
				o.uv = v.uv;
				return o;
			}

			fixed4 frag(v2f i) : SV_Target
			{
				float f = floor(i.uv.z);
				float c = ceil(i.uv.z);
				float blendValue = i.uv.z - f;
				fixed4 tex1 = UNITY_SAMPLE_TEX2DARRAY(_MainTex, float3(i.uv.xy, f));
				fixed4 tex2 = UNITY_SAMPLE_TEX2DARRAY(_MainTex, float3(i.uv.xy, c));
				fixed4 color = lerp (tex1, tex2, blendValue);
				return color;
			}

			ENDCG
		}
	}
	FallBack "Diffuse"
}

and it blend fine but i don’t want textures between…
like in image:

This problem was a headache for me for a long time, but I eventually found a (maybe not perfect but good enough) solution:

Use a fixed4 (I like vertex colors) to create a stepped array lookup value. Basically:
float lookup = float(i.color.r * 8 + i.color.g * 4 + i.color.b * 2 + i.color.a);
This allows up to 16 textures in an array, and works very well with Jason Booth’s Vertex Painter asset. There are small things here and there that might prove annoying, but so far this is the simplest way to effectively achieve this result. Note that to achieve an edge fading effect like yours you’ll need to run a second identical TexArray setup, using another fixed4 such as TexCoord1, and lerp between the two resulting fixed4s like in your given shader.

Hopefully either this is still relevant to your needs, or that someone else with the same issue finds it helpful.