Playmaker Forum

PlayMaker News => General Discussion => Topic started by: qholmes on March 31, 2012, 05:56:21 AM

Title: Performance issues in iPad
Post by: qholmes on March 31, 2012, 05:56:21 AM
Here is my post on the main Unity Forum.. This is such a great group here thought i would put a link to in in case someone could help me shed some light on this problem.. I assume i am just missing something basic that i dont know. (

I hope someone can give me some hints or something..

Title: Re: Performance issues in iPad
Post by: jeanfabre on March 31, 2012, 07:39:07 AM

 could you share screenshots? and explanation of the meshes. I mean if this is for example meshes coming from an export from a CAD software, you are in for a rebuild and tedious optimization basically...

 How many distinct meshes do you have. Combining them is likely the way to go ( reduce drawcall, and easier computation).

 also, in the profiler, Are you positive this is the rendering that is the bottle neck? if you can make a screenshot of the profiler, that would also help.


Title: Re: Performance issues in iPad
Post by: qholmes on March 31, 2012, 08:12:33 AM
Yes i can do some screen shots.. The meshes are not optimized really and are from either max or Acad.. i built them a couple years ago or so..

So my original thought was to do exactly that.. rebuild the meshes and i had started actually but then i did some more reading and watched the Unite 7 video on Optimizing and i thought i would try the Mobile Diffuse or Diffuse Detail shaders... I got all excited when in the Profiler i saw the draw calls go down... but the iPad 2 performance went way down instead of better...

I can reproduce it with a few simple objects.. let me see if i can make a scene that just has a few objects.

But my first question is why would the normal Diffuse shader be way more efficient then the Mobile Diffuse shader especially when it shows way more draw calls with the normal Diffuse shader?

I totally admit that the geometry is heavy but during my reading i basically came to the conclusion that faces and vertex are not nearly as important as they used to be. even on the iPad 2.. it chokes my iPad 1 of course.

What sections of the Profiler do you want to see?

Thanks Jean!!    I am totally stumped on this.. it makes no sense.. in my tests it does not seem to matter about the number of faces but something else... I think maybe when it is batching the objects with the mobile shader it is causing some kind of overhead that i dont understand.. I wish the xcode Instruments had a bit more information about what was going on... maybe they do and i just dont know how to use them

Title: Re: Performance issues in iPad
Post by: qholmes on March 31, 2012, 10:58:44 AM
Ok here are some images.. I did a bunch of tests.. took for ever building to the iPad over and over..

Still not sure what i have figured out but i did screen grabs of the different scenarios..

It seems that Draw calls are more important then Tris and Verts But using Mobile shaders to reduce the Draw calls makes it worse.. Maybe it has something to do with my geometry? Maybe they way they are imported? or Exported?

Title: Re: Performance issues in iPad
Post by: qholmes on March 31, 2012, 10:59:25 AM
A few more images..

Title: Re: Performance issues in iPad
Post by: qholmes on March 31, 2012, 11:33:45 AM
Would it have to do with the Batched groups having too many Tris and Verts?

My model was not intended for Realtime when i built it so i know that i need to optimize it but i just need some kind of guideline as to why i am getting these results..

It could be that i need to stay away from the Mobile shaders and just use optimized and grouped objects?

Title: Re: Performance issues in iPad
Post by: jeanfabre on March 31, 2012, 12:48:53 PM
uhm, You should contact the unity support directly or hope someone with great experience on this answers on the forum.

 as for me, I have to deal with similar issues alot, and I simply state in bold when I sign the specification that the models WILL HAVE TO BE rebuilded and optimized, and that it will come at a expense, because going over a CAD export and optimize generally takes longer than what you are actually suppose to do with it...

 I can recall ( I am talk crap tho) that somehow the way faces are described against the vertices list can affect performances, for example, I could have 1000 vertices in my mesh definition yet, there could be only 1 face, maybe they overlap perfectly, maybe with vertices not used by the face list at all. stuff like can really turn down performance, and is a common thing when you export from CAD.

Have you opened it in a soft like 3d s max before? going from CAD to fbx might also be the problem, try to export as a different format ( find one that exist both in the CAD soft and max), open it in max and then export in fbx.


Title: Re: Performance issues in iPad
Post by: qholmes on March 31, 2012, 04:21:08 PM
Well i built these quite a while ago but i found the drawings done in Autocad so that was very good.. I had them in 3ds max already and that is where they came from actually..

But i tried a few new imports at a lower resolution into Max and they still look pretty good and i should be able to cut the faces down to maybe a third i bet.. I did the doors already and took them from 23k and 28.5k to 4.5k and5.5k   so that is a really good start. And i will group a lot of static same material objects too.. i was just going to be lazy and get Unity to do that but it seems there is something up with that.. I think there are limits to the face size of batches and my iPad hit its limit.. So i will just hope that optimized geometry and custom made groups that are not so big will help.

I might do a test this week to see with groups of objects if i can find a batch limit.. They do talk about that in the Manuals.

Thanks for looking and taking the time Jean!!

Title: Re: Performance issues in iPad
Post by: qholmes on April 01, 2012, 08:43:31 PM
Even with a basic scene my ipad 2 only seems to get 33 fps.. is that normal? Well not a simple scene but when only simple objects like a basic menu are on screen..

I did a lot of rebuilding and batching and i am now up to 26 fps with no AA and 22 with 2x AA not too bad.. I still have some rebuilding to do.

Title: Re: Performance issues in iPad
Post by: jeanfabre on April 01, 2012, 10:17:13 PM
Difficult to say without testing really. But yes, optimization is key once again.

the way I approach optimization was to create a flexible scene doing the following:

 nothing on screen, nothing and every 10 sec I had an object. and so on until I see how it starts getting bad. I arrange them in array so that the do not overlap, AND I animate their transform ( it does change the perfs, if you animate or not, so always animate, and nothing set to static.

 Then you run that app, again and again, with different materials, mesh optimization. It is tedious, but was the onl approach I could find to gain the experience I need to provide suitable visuals with good perfs.

 Only change ONE thing at a time between builds. this is crucial, if you change the mesh adn the mat, you won't know which one had a real effect on the perfs change.

The biggest hurdle we had was actually texture size ( pixel perfect intensive sprites animation, and menus on top of 3d), and scene loading with memory leaks. The mesh and materials caused problems but it was on ipad 1 generation, it went away on ipad2

 You need to really bake as much mesh details as you can into a normal map. This require great skills on your 3d soft like max or maya to generate them properly and accuratly, but you'll gain tremendous perfs by just having box with great textures.

For example, check the substance pod tutorial on the asset store and check how much details are backed on the normal map. I know that sama.van on this forum has such skills, contact him, maybe he'll have  experience on this and be able to help out possibly.


Title: Re: Performance issues in iPad
Post by: qholmes on April 02, 2012, 04:51:49 AM
Yes.. Funny that sounds like my Saturday.. turn on this then build and turn on that and build etc.. I finally just totally gave up on the mobile shaders.. they just consistently killed my performance.

So i rebuilt stuff and combined stuff which really helped.. still not quite there.

But i really need to figure out how to combine my mapped objects into one i guess.. I use map atlases but my objects are all separate and not sure how i merge those.. That is my mission for today i think.

I thought i was done until i realized i didnt have AA turned on...

Yes i can imagine that normal maps would save me a ton more verts.. i will give that a try too.. why not.


Title: Re: Performance issues in iPad
Post by: qholmes on April 02, 2012, 12:12:18 PM
Well i have been testing and testing.. I just turned off Dynamic Batching and got a really big performance boost.. I had it optimized not too bad and it was running quite well except when you rotated the model to certain positions so i had been testing over and over to try and figure out what it was and noticed that the Draw calls changed in those views for some reason so i turned it off and now my draw call went up but the FPS is now rock solid at 33 fps basically all the time and does not drop to 15 anymore.. I dont get it unless it was building batches that were too big maybe?

Same problem i was having with the Mobile shaders.. Which i have since figured out is because of the limitations of batching with certain shaders.. so when i switched to simpler shaders it would batch more and then cause me issues.. Something is going on with the batching.