I downloaded the new 2.6 version and found the main shader I’m using for our ground geometry is broken. It only shows black. Here’s the code:
Shader "Terrain/Three Layer" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Color 1 (RGB)", 2D) = "grey" {}
_MainTex2 ("Color 2 (RGB)", 2D) = "grey" {}
_MainTex3 ("Color 3 (RGB)", 2D) = "grey" {}
_Mask ("Mixing Mask (RGBA)", 2D) = "white" {}
}
SubShader {
// Ambient pass
Pass {
Name "BASE"
Tags {"LightMode" = "PixelOrNone"}
Color [_PPLAmbient]
SetTexture [_MainTex] {constantColor [_Color] Combine texture * primary DOUBLE, texture * constant}
}
// Vertex lights
Pass {
Name "BASE"
Tags {"LightMode" = "Vertex"}
Lighting On
Material {
Diffuse [_Color]
Emission [_PPLAmbient]
}
SetTexture [_MainTex] { constantColor [_Color] Combine texture * primary DOUBLE, texture * constant}
}
// Pixel lights
Pass {
Name "PPL"
Tags { "LightMode" = "Pixel" }
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_builtin
#pragma fragmentoption ARB_fog_exp2
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
#include "AutoLight.cginc"
struct v2f {
V2F_POS_FOG;
LIGHTING_COORDS
float2 uv[4];
float3 normal;
float3 lightDirT;
};
uniform float4 _MainTex_ST, _MainTex2_ST, _MainTex3_ST, _Mask_ST;
v2f vert (appdata_tan v)
{
v2f o;
PositionFog( v.vertex, o.pos, o.fog );
o.normal = v.normal;
o.uv[0].xy = TRANSFORM_TEX(v.texcoord, _MainTex);
o.uv[1].xy = TRANSFORM_TEX(v.texcoord, _MainTex2);
o.uv[2].xy = TRANSFORM_TEX(v.texcoord, _MainTex3);
o.uv[3].xy = TRANSFORM_TEX(v.texcoord, _Mask);
TANGENT_SPACE_ROTATION;
o.lightDirT = ObjSpaceLightDir( v.vertex );
TRANSFER_VERTEX_TO_FRAGMENT(o);
return o;
}
uniform sampler2D _MainTex : register(s0);
uniform sampler2D _MainTex2 : register(s1);
uniform sampler2D _MainTex3 : register(s2);
uniform sampler2D _Mask : register(s3);
half4 frag( v2f i ) : COLOR
{
// get the four layer colors
half4 color1 = tex2D( _MainTex, i.uv[0].xy );
half4 color2 = tex2D( _MainTex2, i.uv[1].xy );
half4 color3 = tex2D( _MainTex3, i.uv[2].xy );
// get the mixing mask texture
half4 mask = tex2D( _Mask, i.uv[3].xy );
// mix the four layers
half4 color = color1 * mask.r + color2 * mask.g + color3 * mask.b;
// match mask alpha
color.a = mask.a;
float3 normal = i.normal;
//multiply and double by the lighting
return DiffuseLight( i.lightDirT, normal, color, LIGHT_ATTENUATION(i) );
}
ENDCG
SetTexture[_MainTex] {}
SetTexture[_MainTex2] {}
SetTexture[_MainTex3] {}
SetTexture[_Mask] {}
}
}
FallBack " VertexLit", 1
}
If I change the return out of the fragment program to just “return color;”, textures show up, but it looks like the tiling is multiplied by a factor of 30…
I’m not adept at shaders yet, and really just cobbled this together from pieces of other shaders, so I’m not surprised it’s messed up. Any insights as to what could be causing it? I’m at a loss…