Hi, wondering if anyone has some insight into the following iPad performance issue:
We’ve set up a 3D area comprising ground mesh, tree billboards (< 20), rotating sky dome, 2 animated birds on splines, 2 boned animated characters and a camera that can animate between points. There are no textures above 250*250. Getting no warnings or errors.
On the iPhone it’s running fine i.e. renders out smoothly when the camera moves through the scene. On the iPad however, the framerate is dropping off a bit, most noticibly during the camera movement.
We’re wondering if we need to be dropping the resolution to something like 800*600? If so, what’s the best way of doing this? I’ve tried Screen.SetResolution() but this didn’t appear to do anything when built for the iPad.
The issue may be with your tree billboards. The iPad has trouble with multiple alpha effects that take up a large portion of the screen, like lots of large particles or fog, that normally run fine on the smaller resolution screen of an iPhone.
Try changing your trees to the cutout shader and see if that makes a difference. ‘Transparent/Cutout/Diffuse’
Thanks for the feedback. I’ve already tried removing all the trees from the scene and saw no performance increase so I suspect they’re not the issue but will look at that further anyway.
Does anyone know if it is possible to set the output resolution to say 800*600 and then let the iPad upscale it?
Found our problem - we had a blob shadow on each character - removing it from both now gives us a steady 30fps Only problem now is getting an alternative projected shadow working that doesn’t kill the framerate. I found the main discussion on blob shadows this morning but there didn’t appear on first glance to be a specific way to implement it correctly - if anyone knows of a solid way to work with blob shadows on the iPhone/iPad it’d be great to hear about it.
its a matter of doing raycasts into the “light - actor” direction starting at the actor and placing a quad with the blob texture at the point of collision (on ground)
I know you found your problem but just to make sure: Are you using camera fog?
When I converted my game to the iPad I found out that camerafog will absolutely kill your performance while it was no problem on the iPhone / iPod. I ended up with writing a shader which gave the exact same result as the fog but with far less performance impact.
I’m not allowed to share it but its a simple shader really. What the shader does is blending a color tint to the texture. A script then controls that color tint, depending on the camera distance it does a lerp between the near fog color and far fog color.
I haven’t noticed any performance impact on the iphone but like I said, on the iPad the difference is huge.
Thanks again for the replies. @Lukas dreamora
Yeah, I’d read somewhere about fogging possibly being a problem. Havn’t been using it in our scene so am pretty sure the blob shadow is responsible. Our characters are pretty static at the moment so we separated a small section of the ground below the characters so only it would take the shadow - that’s done the trick for now. Will have a look into dreamora’s solution later - dreamora - can I ask what type of material you might be applying to the quad in this instance?
Whatever you want basically but normally you will likely use an alpha blend based material so you can get smooth fading of the “blob outline” if that is what you are after.
Alternatively you naturally also can look for a multiply blending based one if you don’t want smoothness, then you can use grayscale textures to do it without alpha blending but that can be tricky at times due to the darkening and balancing out your shadows brightness for the purpose
Could someone could point me to a shader I could tear apart/re-engineer for the fog issue?
We are getting the iPad version of our RPG ready to launch alongside/shortly after the iPhone 3GS version. The problem of the fps dropping significantly is happening in our game as well. When I disable fog, the fps jumps back up.
Any further help you guys could help with would be greatly appreciated.
Take a look at this video of our game Dead Strike:
What we do, is just a billboard mesh particle with only 4 planes at the same time. Not too big, and 1,5 lifespawn secs. We also added a script that make the particle system follow the camera but pointing in a given direction.
@Lukas, thanks for sharing your idea - I am experimenting with a similar technique and would like to test my understanding of your approach:
The shader you’re using applies per object, so that you manage the “fog” effect over distance by applying varying levels of the blend to separate objects. i.e. closer objects have more of their original texture, while further objects have more of the fog tint. That will work great for most of our assets, however from my understanding that means that with this approach a single large object’s pixels are not blended over distance but are applied uniformly to that object, unlike a per-pixel shader solution using CG code snippets (ie Puzzle Bloom’s wasteland to fertile ground technique)? Is my understanding correct?
If anyone has insight into how that can work, or how (if possible) to make CG code snippets work on the iPhone/iPad, I would really appreciate your feedback.
Unity iPhone 1.x does not support programmable pipeline at all (cg / glsl).
Thats a unity iphone 3.x feature and requires a 3GS+ device (and you will want to avoid it on the ipad. never forget: if you use a single shader your whole game is rendered through shaders. normal fixed function pipeline will cease to exist)