Hi, I’m currently optimizing our game for low end iPad systems like the first gen iPad mini and iPad2 in unity 5.1.2p3. In game, I see between 30 and 80ms of “Overhead” each frame. So I produced a test scene which contains:
1 ship, ~7200 verts with a Mobile/Diffuse style shader (no PBR, all #pragma’s on the shader set to simplify it down as much as possible).
1 Directional light
A cubemap skybox.
A camera with no Image Effects
No Shadows or other fancy features
In this extremely simplified scene, I still see around 30ms of ‘Overhead’ on each frame. Occasionally I get an inverse spike with ~2ms of overhead. If I zoom the camera in towards the ship, the overhead gets worse (30ms). When zoomed out, it drops down to 10ms or so.
Given that this is view dependent I would expect the shader cost to be the issue; but the more complex version of this shader draws at the same speed, and there’s basically nothing left in this one. The pixel shader is below:
So, what is causing this “overhead” and how do I track it down and fix it? I’ve seen many reports of what it might be on the net, but none that would explain this. I’m not receiving memory warnings, the shader is about as simple as it gets (and replacing it with just a diffuse texture doesn’t help)
#pragma surface surf Lambert nolightmap nofog noforwardadd noshadow interpolateview novertexlights noambient nodynlightmap nodirlightmap
#pragma target2.0
voidsurf (InputIN, inout SurfaceOutpu to)
{
fixed4 diff = tex2D(_MainTex, IN.uv_MainTex);
fixed rim = 1.0 - saturate(dot(normalize(IN.viewDir), o.Normal));
fixed3 rp = pow(rim, _RimPower) * _RimColor.rgb;
o.Albedo = diff.rgb;
o.Emission = (diff.rgb * diff.a) + rp;
}