I needed some very high resolution Moon maps so I searched and found that I can make my own shader that will put smaller textures together into big one. So I wrote this code
Shader "Custom/surface8" {
Properties {
_MainTex0 ("Base (RGB)", 2D) = "white" {}
_MainTex1 ("Base (RGB)", 2D) = "white" {}
_MainTex2 ("Base (RGB)", 2D) = "white" {}
_MainTex3 ("Base (RGB)", 2D) = "white" {}
_MainTex4 ("Base (RGB)", 2D) = "white" {}
_MainTex5 ("Base (RGB)", 2D) = "white" {}
_MainTex6 ("Base (RGB)", 2D) = "white" {}
_MainTex7 ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex0;
sampler2D _MainTex1;
sampler2D _MainTex2;
sampler2D _MainTex3;
sampler2D _MainTex4;
sampler2D _MainTex5;
sampler2D _MainTex6;
sampler2D _MainTex7;
struct Input {
float2 uv_MainTex0;
};
float2 dbl_uv_MainTex0;
void surf (Input IN, inout SurfaceOutput o) {
dbl_uv_MainTex0 = IN.uv_MainTex0*float2(4,2);
half4 c0 = tex2D (_MainTex0, dbl_uv_MainTex0);
half4 c1 = tex2D (_MainTex1, dbl_uv_MainTex0);
half4 c2 = tex2D (_MainTex2, dbl_uv_MainTex0);
half4 c3 = tex2D (_MainTex3, dbl_uv_MainTex0);
half4 c4 = tex2D (_MainTex4, dbl_uv_MainTex0);
half4 c5 = tex2D (_MainTex5, dbl_uv_MainTex0);
half4 c6 = tex2D (_MainTex6, dbl_uv_MainTex0);
half4 c7 = tex2D (_MainTex7, dbl_uv_MainTex0);
if(IN.uv_MainTex0.x >= 0.75)
{
if(IN.uv_MainTex0.y >=0.5){
c0.rgb = c1.rgb = c2.rgb =c4.rgb=c5.rgb=c6.rgb=c7.rgb =0;
}
if(IN.uv_MainTex0.y <0.500){
c0.rgb=c1.rgb=c2.rgb=c3.rgb=c4.rgb=c5.rgb=c6.rgb=0;
}
}
if(IN.uv_MainTex0.x > 0.5){
if(IN.uv_MainTex0.x < 0.75)
{
if(IN.uv_MainTex0.y >= 0.5){
c3.rgb = c1.rgb = c0.rgb =c4.rgb=c5.rgb=c6.rgb=c7.rgb= 0;
}
else{
c0.rgb=c1.rgb=c2.rgb=c3.rgb=c4.rgb=c5.rgb=c7.rgb=0;
}
}
}
if(IN.uv_MainTex0.x >0.25){
if(IN.uv_MainTex0.x < 0.5)
{
if(IN.uv_MainTex0.y >= 0.5){
c3.rgb = c2.rgb = c0.rgb =c4.rgb=c5.rgb=c6.rgb=c7.rgb= 0;
}
else{
c0.rgb=c1.rgb=c2.rgb=c3.rgb=c4.rgb=c6.rgb=c7.rgb=0;
}
}
}
if(IN.uv_MainTex0.x <= 0.25)
{
if(IN.uv_MainTex0.y >= 0.5){
c3.rgb = c2.rgb = c1.rgb =c4.rgb=c5.rgb=c6.rgb=c7.rgb= 0;
}
else{
c0.rgb=c1.rgb=c2.rgb=c3.rgb=c5.rgb=c6.rgb=c7.rgb=0;
}
}
o.Albedo = c0.rgb + c1.rgb + c2.rgb + c3.rgb+c4.rgb+c5.rgb+c6.rgb+c7.rgb;
o.Alpha = c0.a + c1.a + c2.a + c3.a+c4.a+c5.a+c6.a+c7.a ;
}
ENDCG
}
FallBack "Diffuse"
}
and everything works but there is a seam visible where two textures touch. Screenshot is attached. So, if anybody could help me? I personally split that big texture in Gimp so there is not any dark edge around textures so the seam is not from this.