Search Unity

RenderTexture.GrabPixels = Low FPS [SOLVED]

Discussion in 'iOS and tvOS' started by MrEsquire, Sep 8, 2014.

  1. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Hi guys,

    Currently I'm having a issue with a iOS build, using unity latest.
    The problem is when building the game on iOS Ipad Air, latest iOS 7.1.2

    Camera.Render and Drawing ->
    Camera.AAResolve -> RenderTexture.GrabPixels

    Seems to be killing the CPU

    Screenshot of Profiler:
    http://postimg.org/image/ic4ct5o6l/857a690d/

    We assume this is something to do with the Depth of Field effect used, but we used 3rd party to reduce the CPU drain on iOS.

    Any ideas how to debug this further or help improve FPS but maintain Depth of Field and current effects?

    Thank you
     
    Last edited: Sep 8, 2014
    IgorAherne likes this.
  2. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    >>or help improve FPS by maintain Depth of Field and current effects
    draw NOT to screen but to render target and blit to screen yourself in the end
     
  3. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Alexey, thanks for your reply, I just did some more testing, without changing any code:

    iphone 5s - 27fps
    iPad Air - 7fps

    It seems its a issue with iPads. iPad Air is the most powerful device on the Apple family currently, only thing is different is screen size?

    Any further ideas..
     
  4. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Ok so the issue was with our camera, we had for some strange reason;

    CLEAR FLAGS: Depth Only

    Changing this to solid color fixes performance and we get 60fps
    Ah Unity, one little setting makes so much difference.
     
  5. SimonFireproof

    SimonFireproof

    Joined:
    May 20, 2013
    Posts:
    16
    Hello,

    I'm having this same issue, but it's not as easy for me to solve. I'm using 1 camera to render a background and then another camera to render the foreground and I need to clear the depth buffer between. However when I run my full screen effect I get the slow down you described.

    Does anyone know if this is a Unity issue, or an iPad issue?

    I could render to a texture instead but that's going to be a big memory hit. Any other clever workaround ideas?
     
  6. ayushvora

    ayushvora

    Joined:
    Jul 1, 2016
    Posts:
    12
    Hi Simon, were you able to solve this? We have a similar issue.
     
  7. Ederic

    Ederic

    Joined:
    Jan 21, 2014
    Posts:
    2
    Hi, I'm having the same problem.
    Cameras in the scene with depth only configuration put the frame-rate in Ipad device to 3 fps.
     
    andymads likes this.
  8. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    Seems to be either "depth only" or "don't clear" that cause the problem.

    But.. I just tried keeping "depth only" setting enabled and simply made sure that "Occlusion Culling", "Allow HDR" and "Allow MSAA" are all off and I'm getting a nice framerate now.
     
    Last edited: Jul 10, 2017
    IgorAherne likes this.