Look at this picture. The material to the left is from the same shader as the the one from the object to the right.
Behind is a mesh text that is suppose to always be rendered. The object to the right is a prefag.
If i reset the material it shows correct.
Is this a Unity bug or what is this?
Shader
Tags{ "RenderType" = "Opaque" }
Blend SrcAlpha OneMinusSrcAlpha Cull Back
LOD 400
CGPROGRAM
#pragma surface surf SimpleSpecular
struct Input
{
float2 uv_MainTex;
float2 uv_BumpMap;
float2 uv_EmissionTex;
float3 worldRefl;
float3 viewDir;
INTERNAL_DATA
};
half4 LightingSimpleSpecular (SurfaceOutput s, half3 lightDir, half3 viewDir, half atten)
{
half3 h = normalize (lightDir + viewDir);
half diff;
diff = max (0, dot (s.Normal, lightDir));
float nh = max (0, dot (s.Normal, h));
float spec = pow (nh*_Gloss, _Specular);
half4 c;
c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec) * atten;
c.a = s.Alpha;
return c;
}
void surf (Input IN, inout SurfaceOutput o)
{
half4 tex = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = tex.rgb;
o.Specular = 1;
o.Gloss = 1;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_MainTex))* _BumpLevel;
// Lumination system
half rim = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal));
float4 Tex2D1=tex2D(_EmissionTex,(IN.uv_EmissionTex.xyxy).xy);
float4 Multiply0=Tex2D1 * _EmissionColor;
float4 Multiply2=Multiply0 * _EmissionColor.a;
if (_RimPower > 0)
{
o.Emission = _EmissionColor.a * _EmissionColor.rgb * pow (rim, _RimPower);
}
else
{
o.Emission = Multiply2 * _EmissionColor.rgb;
}
if (_Reflection > 0)
{
o.Emission += texCUBE(_CubeMap, WorldReflectionVector(IN, o.Normal)).r *_Color *_Reflection;
}
}
ENDCG
I dont think its the shader, because if i swap shader and back to this its back to normal. I also seen this problem with standard shaders.