After upgrading to Unity 5 (latest v5.2.1p3), the mesh the following shader is applied to is coming out solid black on iPhone 6 and iPad 2 Air. It’s working correctly on older iOS devices (i.e. iPad 2 / iPhone 4S) and Android devices, just not on newer iOS devices. I’m wondering if ES3.0 or Metal could be causing the problem.
Error codes are:
WARNING: Shader Unsupported: ‘Standard’ - Pass ‘FORWARD’ has no vertex shader
WARNING: Shader Unsupported: ‘Standard’ - Pass ‘FORWARD_DELTA’ has no vertex shader
WARNING: Shader Unsupported: ‘Standard’ - Pass ‘SHADOWCASTER’ has no vertex shader
WARNING: Shader Unsupported: ‘Standard’ - All passes removed
Which has also been posted about here: Unsupported Shader Errors in Chrome and Firefox - Unity Engine - Unity Discussions
Here’s the shader code:
Shader "Custom/UberKitFE_GR" {
Properties {
_MainTex ("MainTex", 2D) = "white" {}
_NumberC ("NumberC", Color) = (0.5,0.5,0.5,1)
_Number ("Number", 2D) = "white" {}
_BumpMap ("BumpMap", 2D) = "bump" {}
_Wrap ("Wrap", 2D) = "gray" {}
_WrapIntensity ("Wrap Intensity", Range(0, 1)) = 0.5
_FresnelColor ("Fresnel Color", Color) = (0.5,0.5,0.5,1)
_FresnelIntensity ("Fresnel Intensity", Range(0, 100)) = 1
_FresnelExponent ("Fresnel Exponent", Range(0, 3)) = 2.5
_SpecularIntensity ("Specular Intensity", Range(0, 0.25)) = 0.13
_Shininess ("Shininess", Range(0, 50)) = 25
_GlossMap ("Gloss Map", 2D) = "white" {}
_Diffuse ("Diffuse", 2D) = "white" {}
_U5tint ("U5 darken", Range(1, 4)) = 3.6
}
SubShader {
Tags {
"RenderType"="Opaque"
}
Pass {
Name "ForwardBase"
Tags {
"LightMode"="ForwardBase"
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define UNITY_PASS_FORWARDBASE
#include "UnityCG.cginc"
#include "AutoLight.cginc"
#include "Lighting.cginc"
#pragma multi_compile_fwdbase_fullshadows
#pragma exclude_renderers d3d11 xbox360 ps3 flash d3d11_9x
#pragma target 3.0
uniform sampler2D _MainTex; uniform fixed4 _MainTex_ST;
uniform sampler2D _BumpMap; uniform fixed4 _BumpMap_ST;
uniform sampler2D _Wrap; uniform fixed4 _Wrap_ST;
uniform fixed _WrapIntensity;
uniform fixed _FresnelExponent;
uniform sampler2D _Number; uniform fixed4 _Number_ST;
uniform fixed4 _NumberC;
uniform fixed _SpecularIntensity;
uniform fixed _Shininess;
uniform fixed _FresnelIntensity;
uniform sampler2D _GlossMap; uniform fixed4 _GlossMap_ST;
uniform fixed4 _FresnelColor;
uniform fixed _U5tint;
uniform sampler2D _Diffuse; uniform fixed4 _Diffuse_ST;
struct VertexInput {
fixed4 vertex : POSITION;
fixed3 normal : NORMAL;
fixed4 tangent : TANGENT;
fixed2 texcoord0 : TEXCOORD0;
fixed2 texcoord1 : TEXCOORD1;
};
struct VertexOutput {
fixed4 pos : SV_POSITION;
fixed2 uv0 : TEXCOORD0;
fixed2 uv1 : TEXCOORD1;
fixed4 posWorld : TEXCOORD2;
fixed3 normalDir : TEXCOORD3;
fixed3 tangentDir : TEXCOORD4;
fixed3 binormalDir : TEXCOORD5;
LIGHTING_COORDS(6,7)
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.uv0 = v.texcoord0;
o.uv1 = v.texcoord1;
o.normalDir = mul(_Object2World, fixed4(v.normal,0)).xyz;
o.tangentDir = normalize( mul( _Object2World, fixed4( v.tangent.xyz, 0.0 ) ).xyz );
o.binormalDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w);
o.posWorld = mul(_Object2World, v.vertex);
fixed3 lightColor = _LightColor0.rgb;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
TRANSFER_VERTEX_TO_FRAGMENT(o)
return o;
}
fixed4 frag(VertexOutput i) : COLOR {
i.normalDir = normalize(i.normalDir);
fixed3x3 tangentTransform = fixed3x3( i.tangentDir, i.binormalDir, i.normalDir);
/////// Vectors:
fixed3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
fixed3 _BumpMap_var = UnpackNormal(tex2D(_BumpMap,TRANSFORM_TEX(i.uv0, _BumpMap)));
fixed3 normalLocal = _BumpMap_var.rgb;
fixed3 normalDirection = normalize(mul( normalLocal, tangentTransform )); // Perturbed normals
fixed3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
fixed3 lightColor = _LightColor0.rgb;
fixed3 halfDirection = normalize(viewDirection+lightDirection);
////// Lighting:
fixed attenuation = LIGHT_ATTENUATION(i)*2;
////// Emissive:
fixed4 _GlossMap_var = tex2D(_GlossMap,TRANSFORM_TEX(i.uv0, _GlossMap));
fixed3 emissive = ((_FresnelIntensity*(pow(1.0-max(0,dot(normalDirection, viewDirection)),_FresnelExponent)*i.posWorld.g*i.posWorld.g)*_FresnelColor.rgb)+(pow(max(0,dot(normalDirection,halfDirection)),(_Shininess*_GlossMap_var.r))*_SpecularIntensity));
fixed2 node_44 = fixed2(0.5*dot(normalDirection,lightDirection)+0.5,0.0);
fixed4 _Wrap_var = tex2D(_Wrap,TRANSFORM_TEX(node_44, _Wrap));
fixed4 _Number_var = tex2D(_Number,TRANSFORM_TEX(i.uv1, _Number));
fixed node_3845 = (1.0 - _Number_var.a);
fixed4 _MainTex_var = tex2D(_MainTex,TRANSFORM_TEX(i.uv0, _MainTex));
fixed3 node_4347 = ((_NumberC.rgb*_Number_var.a)+((node_3845*node_3845)*_MainTex_var.rgb));
fixed4 _Diffuse_var = tex2D(_Diffuse,TRANSFORM_TEX(i.uv0, _Diffuse));
fixed3 finalColor = emissive + (((((_Wrap_var.rgb*_WrapIntensity)*node_4347)+(UNITY_LIGHTMODEL_AMBIENT.rgb*node_4347))+(node_4347*max(0,dot(lightDirection,normalDirection))))*(_LightColor0.rgb*attenuation)*_Diffuse_var.rgb);
fixed3 finalColorU5 = finalColor / _U5tint;
return fixed4(finalColorU5,1);
}
ENDCG
}
}
}