- Home /
Problem with custom shader on ios
Hi everyone! I am new to writing shaders and I have a problem with a shader when working on iOS. It works on android device, unityEditor_iOS, unityEditor_android, but on iOS device it switches to "Mobile/VertexLit" and AO does not work. What is going wrong? I would be grateful for any help.
iOS device: IPad mini 4, iOS 12.1.4. Unity 2018.2.5f1. Xcode 10.1
Shader code:
Shader "Pixels_Base" {
Properties{
_MainTex("Base (RGB)", 2D) = "white" {}
[HDR]_Color("Color", Color) = (1,1,1,1)
_AO("AO", 2D) = "white"{}
_AOpow("AO Power", range(0,2)) = 1
}
SubShader{
Tags{ "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert keepalpha addshadow fullforwardshadows novertexlights nolightmap nodynlightmap nodirlightmap
#pragma only_renderers d3d9 glcore gles gles3 metal
#pragma target 3.0
sampler2D _MainTex;
sampler2D _AO;
fixed _AOpow;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
float2 uv2_AO;
};
void surf(Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
fixed3 ao = lerp(1, tex2D(_AO, IN.uv2_AO), _AOpow);
o.Albedo = c.rgb * _Color * ao.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Mobile/VertexLit"
}
Unity Player Settings:
renderingsettings2.png
(28.0 kB)
renderingsettings1.png
(71.0 kB)
Comment