Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

iPad 2 performance issue

Discussion in 'iOS and tvOS' started by qholmes, Mar 31, 2012.

  1. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    I was having double touch performance issues and when i turned off a geometry group then went away so i figured i needed to optimize some to improve performance.. This is my first iOS project..

    So in the profiler under Rendering my normal scene was at 767 calls and 491 k Tris and 443 k Verts
    Most of my materials are just diffuse.. I have one light no shadows etc..

    When i turned off my geometry group my numbers were 292 draw, 399k Tris, 358 k Verts
    So the biggest thing was the draw calls which i had learned by reading and watching a Unite vid is the killer..

    So i started switching my materials to Mobile Diffuse or Mobile Diffuse Detail.. I got my draw calls down to about 225. My colors were messed up because i did not have textures for my materials i was just testing. Was that a problem??

    Anyway my performance was really bad now.. According to xcode Instruments it dropped to 8-10 fps...

    With my geometry group turned off it was about 30 fps and the double touch performance was great.

    Why................. why would using the mobile shaders make it worse especially when the Profiler showed such great improvement?

    Q
     
  2. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    So if i take my smaller sub set of geometry i get 30 to 32 fps in the instruments.. If i change two of the main materials from standard diffuse to Mobile diffuse detail then it drops to 17 fps.

    In the Unity Profiler the performance is better but on the iPad it is worse.. I cant remember the numbers except for the fps.. Cant seem to find the instruments that give me draw calls etc for the iPad.

    Q
     
  3. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    I just tried the Mobile Vertex Lit which is supposed to be the fastest shader and i got the same drop in performance..

    I also did a test where i took out some heavy mesh objects that left the draw call count higher but dropped the vertex count quite a bit and still low performance..

    I am stuck.
    Q
     
  4. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    So i did a bunch of testing.. It seems that when i use the mobile shaders it batches a lot more of the objects.. But i think the batching is killing it some how... Are there limits for iPad 2 on batch sizes? too many verts or tris? I am thinking there are.

    I am currently optimizing meshes and re importing and also combining some meshes to reduce draw calls without using the mobile shaders which seem to push the groups over the edge.. If that is the case it would be good to be able to control the batch sizes created??

    Q
     
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Are you using projectors?

    How many lights?


    Both the above will dramatically increase drawcalls. And I mean dramatically :)
     
  6. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    No projectors and one light.. I plan on doing lightmaps but am not there yet.. It not sure how to do it with transparent objects and things like that but i am not there so have not tried either...

    This problem is strange.. I get worse performance with the mobile shaders and more batching then when i do with normal shaders and less batching,.. I have a bunch of screen grabs i made if that would help... I plan on doing a test this week using just basic objects and with and without batching on my iPad 2 and see if it switches from helping to making it worse at some point

    Q
     
  7. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    Here is something i dont get.. Under Quality Settings if i set my Pixel Light to 0 instead of 1 my Draw calls drop a lot in the Profiler but my FPS on my iPad 2 does not change at all i dont think? I dont see any difference in the look of the app?

    And it is strange i cant get anymore then 33 fps on my iPad too even when my app is in a menu or something. Is it capped at 33 or so fps?

    I am still having issues with mobile shaders and my performance.. I have reduced my drawcalls and Tris and Verts quite a bit and the performance is better so i thought now i should try some mobile shaders but they killed it again and if i switch them back then it is still stuck in some kind of problem state i have to open an older revision to clear it for some reason... It is acting like a bug...

    But maybe i have my iOS settings set wrong maybe? causing issues?

    Q
     
  8. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Its not capped unless you set the target framerate.

    But you can check the profiler graph on whats actually taking that long. A heavy ongui usage can easily be significantly heavier than the game level itself.
     
  9. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    But the Profiler does not help me really with iPad performance... It gives me an idea but from what i have found lately it seems to react different which made sense to me as it is a different technology..

    I use ez Gui for my gui stuff so it should be pretty quick i would think.. but you are right i should really just turn everything off and just add one thing at a time.. concentrating on my model right now.. this is not an optimized game but a product visualization with a big CAD model.. so a bit different.

    Q
     
  10. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    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.

    Q

    Q
     
  11. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    You need to post what the profiler sees. You might not think it's showing useful stuff, but usually, it is. I don't mean to sound like an ass but you could have missed something.

    From what this looks like, it could be a CPU problem, not a GPU problem. I'd need to properly see your profiler results to know. Anything else looks like guessing.

    There's some performance fixes in the upcoming 3.5.1 patch.
     
  12. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    Hey man i am not proud... I could be missing 50%.. i know you just mumbled ...more like 80% ...Hehe

    I totally agree on the cpu.. All my tests seem to show that it is not Draw Calls or Tris or Verts.. Those numbers seem to go all over the place.

    I can do some screen grabs of the CPU Profiler expanded.. See what we see. It is just weird that i basically have to get rid of most of the batching to make it work well.. but like i said this is not a gave with a bunch of small simple objects.. So i think you have to look at it differently.

    Ok will see what i can grab a good and a bad scenario... i can look at the Xcode Instruments CPU stuff too..
     
  13. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    Ok so is there something in particular you want to see? I did a quick test that was not a really extreme test and there appeared to be no change in the cpu.. either in the profiler or in the xcode instruments..

    Q
     
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I'd just like to see a screenshot of the profiler in general while running when it's slow.
     
  15. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
  16. AC01

    AC01

    Joined:
    Apr 2, 2012
    Posts:
    1
    Interesting, my artists just told me that using vertix lighing...."...the big thing
    we've run into is it splits the vert information, effectively doubling our
    vert count."

    Are you seeing the same thing in Max/Maya?
     
  17. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    Added pictures here.

    I can make new ones if you want.. If there are different scenarios that you want to see.. These were earlier tests.

    Q
     

    Attached Files:

  18. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    could you take a screenshot of it with mobile shaders, with:

    1. cpu tab selected
    2. gpu tab selected

    The rendering tab rarely gives anything useful in this case.

    Btw you need optimised shaders regardless and you need to batch more. 100+ draw calls is too many for any mobile. Is static batching turned on? and also you probably need to wait fil 3.5.1 for a true look at the performance.
     
  19. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    Well i can tell you that when i set my vertex lighting to 0 my count does drop in half but not sure that is really affecting me as i am not using much vertex lighing... Hmmm in wonder if some of the mobile shaders i was trying were vertex lighting.. Sorry i dont know much about shaders so i am doing my best to talk the lingo... and my damn iMac display wont turn on right now so i cant tell you much more without rebooting it...

    Q
     
  20. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    Ok i have to reboot my iMac.. i have issues with the display not coming back on when it goes to sleep.. well not to sleep as i have turned that off but the display going off.. been this way since it got it and it drives me crazy..

    Will get the screen grabs.

    Well i was heading down the shader route but that is when i hit all these issues and it was worse.. Well my original draw calls was 767 so i have come down a lot since then... When i turn off Dynamic batching my draw calls jump to 306 from 162 and it runs way better.. at 162 it is slower in general and hits slow view points where it is 15 fps.

    Sounds like 3.5.1 will help with diagnostics... that would be good.. I just want to understand what is going on so i can fix it... I still have some object face reduction to do and also more grouping as well.. But with Dynamic Batching on it runs perfect.. 306 draw calls and how ever many verts and tris

    Q
     
  21. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    Here are some screen grabs.. I did a bunch of optimizing so the differences are not as dramatic as they were.. It used to drop to 5 fps when i did the mobile shaders..

    Q
     

    Attached Files:

  22. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    one more

    Q
     

    Attached Files:

  23. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    3.5.1 contains batching and other performance increases, but I can't see what's wrong from that - it looks ok. Perhaps the glass shader is a desktop glass shader?

    Hows it run if the only shader you use is VertexLit in mobile? if it runs awesome there we're looking at a shader problem overall. Have you actually tried static batching? I'm not talking about dynamic batching... But this looks like something static batching would fix. Although 3.5.1 is worth waiting for, any day now.
     
  24. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    Yes i thought it was the glass shader so i turned off all those objects and it made no difference.

    I suppose there is no way to override all the shaders to one? I can change all the materials to that shader.. there are not that many i guess.

    Yea i have to get an update to my clients tonight for a progress meeting with the big bosses.. But i want to figure this out as i will use this in all my work.

    Q
     
  25. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    Ok converted all my shaders to Mobile VertexLit which was a pain as i use the Color field in my code everywhere but i got them all turned off i think.. and i get between 12-17 fps in xcode.. I cant run in profiler as i am missing a color reference somewhere and it keeps throwing an error and i cant find it.

    Q
     
  26. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    Ok converted all my shaders to Mobile VertexLit which was a pain as i use the Color field in my code everywhere but i got them all turned off i think.. and i get between 12-17 fps in xcode.. I cant run in profiler as i am missing a color reference somewhere and it keeps throwing an error and i cant find it.

    Q
     
  27. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    And why would it not?
    Build the client with development and profiler enabled, ensure that the device running it and unity are on the same network and you can profile your game running on the device with the profiler and get meaningful informations.
    Yes you don't have the GPU profiler but going by your graphs you don't need them as you are not having a situation with gradual changes at least going by your screens and from whats readable due to their size. Its either fine or 'dead', so nothing too usefull to extract relevant informations from (and if its really relevant use the integrated opengl profiler in xcode / download gDebugger which is free to do it on the device itself). also you don't have a level where you can optimize parts for which you would need the graphs to find the bottleneck moments as thats basically always the time.


    Profiling a mobile issue on iOS on the desktop is 99% of the time totally worthless especially when graphics are involved as PowerVR work so completely fundamentally different than desktop ones and the unity wanna be rendering emulation does not capture anything of that actually, its only a 'shader and gl extension limitation' rendering pipeline, thats like 5% of what the delta is, at maximum

    The only potentially useful 'simple' performance enhancement I could think off basing on the informations I see here is the usage of occlusion culling with manually placed portals to at least reduce the processing and handling overhead as you are hitting the cpu pretty heavy at times - this could naturally be caused by something but rendering but without knowing what your code does in detail, I at least though pointing this out as an option could be handy, cause without OC the whole thing is always drawn independent of what you see in side visually
     
    Last edited: Apr 3, 2012
  28. qholmes

    qholmes

    Joined:
    Sep 17, 2010
    Posts:
    162
    Interesting.. I am a bit new and did not think of that or really know that feature was there. I know i have seen that option under the build options but didnt think of it.. So that is a cool thing to try.

    My image posts if you open them in a separate window are pretty large if that was what you meant..

    I will look for gDebugger to run in xcode.. I was expecting more information from the xcode instruments actually..

    I would not say that the code is that heavy.. but i am also not a pro at this stuff either.. So i could be totally wrong. There seems to be some natural OC happening as i rotate around the object as i can watch the draw calls change.. but not a lot.. The one view point that seemed to always drop in frame rate is a few that showed a bunch of small objects all lined up behind each other like looking through a forest of trees... when i was looking from say ground level the FPS drops but if i rotate it up to a a slight aerial view then the FPS goes back up... like it was trying to calculate the depth sorting or something.. I thought it was a transparent shader having to do depth sorting but changed that to opaque and it was the same..

    Through all this testing i saw this issue with low draw calls around 60 i think and then run great at 460 or more draw calls and then the same with verts and tris.. I am totally convinced it is some kind of cpu calculation issue but i just cant put my finger on what exactly..

    And i dont quite understand everything you said.. a little bit over my head and experience but i will look at these other tools and see if i can figure something out.

    Thanks for taking your time!!!

    Q