iPhone Optimization guidelines

So I am new to iPhone dev and am having some problems getting my game to run well.

I built what I thought was a simple scene (Beast baked light maps, no realtime lights, capsule for main character in a fairly simple scene I made in blender) and when I built it in xCode the framerate on iPhone was unplayable.

What are the biggest FPS killers in iPhone dev? What are some good rules of thumb for art assets (polycounts/textures etc.)?

EDIT:
-Are raycasts expensive on the iPhone?

-Is it faster to use a text mesh or an OnGUI label on iOS?

How do I not use/disable opengl 2.0?

Turn on the profiler and see where the problem is.

–Eric

Biggest Speed improvments on ipad and iphone4 in general (doesnt affect 3gs too much):

  • dont use opengl 2.0
  • dont use shaders using transparancy of any kind
  • if you do use transparent something keep the as small as possible on the screen
  • dont use blob shadows (as this will result in transparancy calculations)
  • dont use lensflares (transparency)
  • use mobile shaders (you find some in standard assets)

the polygoncount itself is not so important on ipad/iphone4/3GS

blob shadows aren’t bad due to the transparency itself. They are bad because each object hit by them will render its mesh with the “blob material” again basically.

Including GUITextures (for GUI)?

PS: ‘of any kind’ is clear, but i need to be sure :wink:

Yes includes guitextures etc. the problem is the overdraw of pixels already drawn, not what is overdrawing

Clarification :
Transparency is not bad on iPhone.

It’s AlphaTesting that is ultra-bad. AlphaBlending is very ok.

Damn… the basic principle of all my gui objects is TRANSPARENCY

LOL

It is actually, you have a 960x640 display which the GPU can barely handle, so having too much transparency/overdraw tends to slow things down noticeably. You can drop that to 480x320 and then there’s no problem, but then of course you have a low-res display.

–Eric

Is this typical of released games? Or is having a game that doesn’t use the max resolution a taboo?

Also, what is the max recommended texture size for iPhone 4? I am making an atlas texture so a bunch of objects can share materials, how big can my texture atlas be? 1024? 2048?

P.S. What is the purpose of the new “background” shader that came in 3.2

hey you can use openGL 2.0 without problem ( or at least not much ) if you optimize your shader correctly…I everytime wonder with these opti question cause you mostly may test out things for yourself on your particular project …fro some of project i am on , we use particle stuff , gl 2.0 , GUItexture etc , we pass over the politically correct limit of the 30 draw call and so on…

ok we don’t target 60fps and we are not on 4g retina , that help …All that really matter is what your app is doing and do some stress test , check the profiler to spot where things get bad etc …:wink:

Okay yeah so my problem was definitely the blob shadows. I had 5 capsule characters all standing on the same mesh each with a blob shadow. Now that they are gone there is no problem

My game is a platformer though, so down facing shadows are really helpful for judging height of the character. What are some good alternatives to blob shadows?

Use a raycast and show a quad on the platform or use the decal system for example.

Blob Shadows are so bad because they cause the meshes they hit to redraw with the projector material → many new drawcalls etc

Is there a built in decal system in unity?
I’d love to get rid of the blob shadow but I can’t use a shadow quad because I have an uneven ground mesh.

So how common is it to release a 3D game at 480x320 instead of 960x640?

I would say the uncommon release is a full retinal display 3D game. Even on consoles games are not full res to get a better frame rate.

OK my tips for optimize :

  1. goto Edit-> Time Settings and decrease max allowed timestep to : 0.1 if your game does not depend on great physics features timesteps can enforce your render speed.
  2. make sure you don’t use to many draw calls , I reduce draw calls from 300 to 40 just mixing up with materials and lightmaps
  3. use some reasonable verts count : 10 K - 15 K for iPhone 4 or iPad or less then 8K for iPhone 3G or simmilar devices
  4. use smaller smaller quality for standalone
  5. use garbage collections on start of your scene
  6. mixup with layer matrix’s in Physx Editor , see which layers don’t interact and uncheck them
  7. optimize your scripts, don’t use lot’s of scripts with lot’s of Updates functions or FixedUpdate or similar functions , use as little as possible number of scripts .

In short that’s my tips for optimizations .

in 3.2 there is mobile quality settings