If i change it to clamp, only 1 texture normal others getting one color. So i cant choose clamp i think it req divide sphere to objects. Currently one object and 18 material. If i divide it to 18 sphere part. It will get smoothing problem.
Shader:
Shader "Custom/Planet" {
Properties {
_MainTex11 ("Texture 1 1", 2D) = "white" {}
_MainTex12 ("Texture 1 2", 2D) = "white" {}
_MainTex13 ("Texture 1 3", 2D) = "white" {}
_MainTex21 ("Texture 2 1", 2D) = "white" {}
_MainTex22 ("Texture 2 2", 2D) = "white" {}
_MainTex23 ("Texture 2 3", 2D) = "white" {}
_MainTex31 ("Texture 3 1", 2D) = "white" {}
_MainTex32 ("Texture 3 2", 2D) = "white" {}
_MainTex33 ("Texture 3 3", 2D) = "white" {}
_MainTex41 ("Texture 4 1", 2D) = "white" {}
_MainTex42 ("Texture 4 2", 2D) = "white" {}
_MainTex43 ("Texture 4 3", 2D) = "white" {}
_MainTex51 ("Texture 5 1", 2D) = "white" {}
_MainTex52 ("Texture 5 2", 2D) = "white" {}
_MainTex53 ("Texture 5 3", 2D) = "white" {}
_MainTex61 ("Texture 6 1", 2D) = "white" {}
_MainTex62 ("Texture 6 2", 2D) = "white" {}
_MainTex63 ("Texture 6 3", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex11;
sampler2D _MainTex12;
sampler2D _MainTex13;
sampler2D _MainTex21;
sampler2D _MainTex22;
sampler2D _MainTex23;
sampler2D _MainTex31;
sampler2D _MainTex32;
sampler2D _MainTex33;
sampler2D _MainTex41;
sampler2D _MainTex42;
sampler2D _MainTex43;
sampler2D _MainTex51;
sampler2D _MainTex52;
sampler2D _MainTex53;
sampler2D _MainTex61;
sampler2D _MainTex62;
sampler2D _MainTex63;
struct Input {
float2 uv_MainTex11;
};
void surf (Input IN, inout SurfaceOutput o) {
if (IN.uv_MainTex11.x >= 5.0/6.0) {
if (IN.uv_MainTex11.y >= 2.0/3.0) {
o.Albedo = tex2D (_MainTex61, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
else if (IN.uv_MainTex11.y >= 1.0/3.0) {
o.Albedo = tex2D (_MainTex62, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
else {
o.Albedo = tex2D (_MainTex63, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
}
else if (IN.uv_MainTex11.x >= 4.0/6.0) {
if (IN.uv_MainTex11.y >= 2.0/3.0) {
o.Albedo = tex2D (_MainTex51, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
else if (IN.uv_MainTex11.y >= 1.0/3.0) {
o.Albedo = tex2D (_MainTex52, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
else {
o.Albedo = tex2D (_MainTex53, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
}
else if (IN.uv_MainTex11.x >= 3.0/6.0) {
if (IN.uv_MainTex11.y >= 2.0/3.0) {
o.Albedo = tex2D (_MainTex41, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
else if (IN.uv_MainTex11.y >= 1.0/3.0) {
o.Albedo = tex2D (_MainTex42, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
else {
o.Albedo = tex2D (_MainTex43, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
}
else if (IN.uv_MainTex11.x >= 2.0/6.0) {
if (IN.uv_MainTex11.y >= 2.0/3.0) {
o.Albedo = tex2D (_MainTex31, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
else if (IN.uv_MainTex11.y >= 1.0/3.0) {
o.Albedo = tex2D (_MainTex32, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
else {
o.Albedo = tex2D (_MainTex33, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
}
else if (IN.uv_MainTex11.x >= 1.0/6.0) {
if (IN.uv_MainTex11.y >= 2.0/3.0) {
o.Albedo = tex2D (_MainTex21, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
else if (IN.uv_MainTex11.y >= 1.0/3.0) {
o.Albedo = tex2D (_MainTex22, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
else {
o.Albedo = tex2D (_MainTex23, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
}
else {
if (IN.uv_MainTex11.y >= 2.0/3.0) {
o.Albedo = tex2D (_MainTex11, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
else if (IN.uv_MainTex11.y >= 1.0/3.0) {
o.Albedo = tex2D (_MainTex12, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
else {
o.Albedo = tex2D (_MainTex13, IN.uv_MainTex11 * float2(6.0, 3.0)).rgb;
}
}
}
ENDCG
}
FallBack "Diffuse"
}
remove grid by changing texture wrap mode from 'repeat' to 'clamp' shader limits can be avoided, for example ignoring tiling/offset of textures is way to decrease calculations post your shader - i'll look
– ScroodgeMnever use textures with non-power-of-two size in 3d graphics. use 4096x4096 and it will takes no more then 64MB per texture, 48MB without alpha channel
– ScroodgeMsorry for shader, but i didn't found a way to make more then 16 textures. before that all limits was avoided in my practice 8). this one looks like compiler limit. hope unity4 will support texture arrays. about memory i said already, 4096x4096 RGBA 32bit texture will take 64MB (without mipmaps). and the last. to avoid sharp edges on textures seams, first switch them to clamp instead of repeat, second - make a 1-pixel border same on seamed textures (so top pixel row on bottom texture should be same as bottom pixel row on top texture and so on)
– ScroodgeMis this error always occurs on 11s loading? try to load different images without any associating with material?
– ScroodgeMwithout associating with material, errored. i used different images too. TextureLoader.LoadImageIntoTexture(TextureLoaded) making error. When i remove it, working (loading all images without error). i used TextureLoaded.Resize instead of it but same. If i keep without DXT1, memory problem. (After ~4GB memory in use or over ~1.2GB ie memory, giving error. Yeah i have more memory and 64 bit pc) strange but i added "yield return new WaitForSeconds(3);" after this code it loaded up to 16 then errored.
– SuperProgrammer