Poor fog performance on the iPad?

I have a simple scene set up with the following items in it

  1. Skybox (using the RenderFX/Skybox material)
  2. Ambient light
  3. Fog (density of .2)
  4. Tessellated plane with a vertex lit material, 0 shininess, no emissive.

I modified AppController.mm to set kFps to 60.

I also added a little script to toggle RenderSettings.fog.

When the fog is active, the game gets around 30fps.

With the fog disabled, I'm getting 60.

(I'm using something similar to this script to draw the FPS on the device: http://www.unifycommunity.com/wiki/index.php?title=FramesPerSecond )

My question is twofold. One, is this expected behaviour, and two, if it isn't, is there something I'm missing to make fog not kill performance as much?

There currently seems to be a bug in iPhoneOS / iOS that makes rendering fog very inefficient. So while not exactly "as designed", this can be considered "expected behavior". So you should avoid using fog on the iPad.

I'm not perfectly sure how relevant this is for Unity iPhone - but you might want to check out Creating a fogless version of a built-in shader. If that works well for iPhone, you should be able to switch all shaders to "without fog" and then, whenever fog doesn't kill performance anymore could return to the original shaders.

Very likely the iPad's framerate is tied to the LCD's refresh rate and works only in discrete increments. That means that your framerate would drop from 60 to 30, not something like 51 or 46. You can read more at the forums - it's brought up every so often.

Having said that, I understand fog isn't exactly cheap, but someone else can probably provide better numbers.