- Home /
U5 shader coming out solid black on newer iOS devices (iPad 2 Air / iPhone 6)
After upgrading to Unity 5, 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: http://forum.unity3d.com/threads/unsupported-shader-errors-in-chrome-and-firefox.351915/
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
}
}
FallBack "playrKit/playrKit_FE"
}
You could try to discard $$anonymous$$etal in Player Settings. Add GLES3 and GLES2 so that if one does not work the next is used but never $$anonymous$$etal.
I get the same problem but sort of in reverse in Unity 5.2.2f1. The problem is seen in an old iPad2($$anonymous$$E400LL/A iOS 9.1). However everything works nicely on iPhone6 (iOS 9.1), also i saw no problems on iPad Air 2 (don't know iOS ver.) and heard there were no problems on an iPhone 5 (don't know iOS ver). Same problem whether using cloud build or Xcode locally (as comparing between the iPhone6 and the old iPad 2).
The menu screen load ok in both cases, however when trying to load the game screen with skybox and terrain (set to default unity shader) the game screen music is heard but the menu screen graphics remains visible(though no longer responsive). This happens only on the iPad 2. On the newer devices gameplay was very smooth and everything worked. The shader warning log after pressing the start-game button looks familiar to this thread: old iPad2 debug log
iPhone6 debug log with same build (just switched the device Xcode open (For some reason I got filetype complain on trying to add this second text file here, so I zipped it. )
The strange thing is that it used to work just fine also on the iPad 2. Not sure where something happened, I guess I need to try some older cloud builds to see how far it works. I did recently upgrade to Unity 5.2.2f1.
Your answer
Follow this Question
Related Questions
How to make a 2d shader with edge waves 0 Answers
Single tone shadows in forward rendering 0 Answers
Fake Volumetrics via custom bloom 0 Answers
URP Blit Render Feature not rendering in Single Pass Instanced VR 0 Answers
Converting c# function to shader. 0 Answers