- Home /
Poor fog performance on the iPad?
I have a simple scene set up with the following items in it
- Skybox (using the RenderFX/Skybox material)
- Ambient light
- Fog (density of .2)
- 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?
Is this in the iPad simulator or on the actual device that the performance is degrading?
Answer by jashan · Jun 16, 2010 at 01:39 PM
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.
Answer by Ricardo · Apr 07, 2010 at 07:24 AM
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.
The thing is, I added another object to the scene (a large additive particle), and the framerate goes from 15fps with fog to 45 fps with fog.