Author Topic: Low performance of Quest log demo on iOS  (Read 7626 times)

wsycarlos

  • Guest
Low performance of Quest log demo on iOS
« on: October 22, 2012, 04:40:49 AM »
I only get like 17 frames per second of the Example 9 Quest Log on my iPod touch 4
and it is very weird because the draw call is only 5 and the tris is only six hundred.
Anyone can explain why ? Or what do I need to set something or turn off anything?

mdeletrain

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 71
    • View Profile
Re: Low performance of Quest log demo on iOS
« Reply #1 on: October 22, 2012, 10:24:40 AM »
This example uses soft-clipping which is completely unusable on anything older than iPhone 4s (think iPhone 3G, iPhone 3GS, iPhone 4, iPod counterparts of those devices such as your iPod 4 gen, iPad 1).
This is because of the use of a pixel shader that performs pixel blending on nearly all screen's surface. As a side note, since hard clipping is implemented in the same manner, you will not notice any speed bump using it instead.
You can try to convert the example so that it uses a draggable camera instead of a draggable panel : you'll get fast hard clipping.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Low performance of Quest log demo on iOS
« Reply #2 on: October 22, 2012, 12:46:02 PM »
Alpha clipping is the fastest of the clippings according to my tests.

Doing clipping with a camera is also very fast. but much more unwieldy.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Low performance of Quest log demo on iOS
« Reply #3 on: October 22, 2012, 05:12:20 PM »
Default NGUI shaders do alpha blending. When targeting older mobile devices you have to be creative and change the shaders to avoid alpha blending whenever possible (or at least avoid placing widgets on top of each other, as it results in writing to the same pixel more than once -- horribly slow on older mobile devices). Alpha pre-multiply approach would result in better performance.

wsycarlos

  • Guest
Re: Low performance of Quest log demo on iOS
« Reply #4 on: October 22, 2012, 09:24:53 PM »
I think the problem with this demo caused by UITable in my opinion, because when I close the clipping of this demo,it also has very low performance on my touch, while the demo Draggable panel demo also use clipping works fine on it, so that seems that the low performance is caused by the CPU calculation.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Low performance of Quest log demo on iOS
« Reply #5 on: October 22, 2012, 09:32:54 PM »
Table doesn't recalculate anything while it's stationary. It only recalculates while you're shrinking / expanding the elements. That sample has a fair amount of overdraw, which combined with alpha blending on an older mobile device causes a slowdown when it comes to writing to the same pixel more than once. This is known as poor fillrate. That's my guess anyway. You can try disassembling it and enabling/disabling different widgets to see if it helps.

wsycarlos

  • Guest
Re: Low performance of Quest log demo on iOS
« Reply #6 on: October 22, 2012, 10:20:27 PM »
Yes, I am try to do so,while I found that tile sprite may be the problem. UITiled Sprite ? What is tiled sprite, do I have to avoid using this one on iOS device?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Low performance of Quest log demo on iOS
« Reply #7 on: October 22, 2012, 10:23:37 PM »
It's what you use to fill an area, repeating the sprite over and over. It doesn't have any more cost than any other sprite. As I mentioned, the problem is likely in several sprites overlying the same area, thus writing to the same pixels more than once.

wsycarlos

  • Guest
Re: Low performance of Quest log demo on iOS
« Reply #8 on: October 22, 2012, 10:54:16 PM »
Yeah you are right, and last question,what is the depth pass of UIPanel?
I think that's the mainly problem, while also too many widgets is another one.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Low performance of Quest log demo on iOS
« Reply #9 on: October 23, 2012, 01:27:09 AM »
Depth pass is if you need your UI to write to depth. It's mainly for user interfaces drawn as a part of the world, and for when you want to reduce fillrate of the game that has a 3D UI that's also a part of the world.

sunkas

  • Guest
Re: Low performance of Quest log demo on iOS
« Reply #10 on: November 16, 2012, 05:13:37 AM »
Quote
Alpha pre-multiply approach would result in better performance.

Can you recommend any shader to use for mobile devices?  We have a lot of sprites (including UILabels) on the same scene that uses transparency and are on top of each other. They are in a clipped panel (hard) and the performance is quite slow on iPhone 4.

Thanks in advance!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Low performance of Quest log demo on iOS
« Reply #11 on: November 16, 2012, 05:10:41 PM »
Hard clipping is not recommended for mobile devices. It will flat out crash some Android ones, as a matter of fact.

If you want to improve performance, reduce the amount of overdraw in general. For example if you have a window made out of several sliced sprites, some of which only have borders, turning off "fill center" option on them is a good idea. Shader-wise, here is a PMA shader written by David Whatley of Critical Thought Games.