Search Unity

[BUG] ARFoundation 2.1 / ARKit framerate slowdown

Discussion in 'AR' started by Aaron-Meyers, Jul 23, 2019.

  1. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    305
    I'm noticing that often when I am running my project, the camera framerate will begin running at a very smooth 60fps, but then drop to what appears to be 30fps.

    When the framerate drops, panning movements look really bad because the 3D elements are still drawing at a higher framerate. I've been developing this project with ARFoundation 2.1.0 and Unity 2019.1.4, but noticed couple days ago that 2.1.1 was available so I moved up to that. I noticed that 2.1.1 has a toggle on the ARSession component to attempt to match Unity's frame rate, but that doesn't seem to be helping.

    This problem persists with 2.1.0, and 2.1.1 with both settings for the match frame rate toggle. I'm running on the most recent iPad Pro so I would not think that processing power is an issue here. Is this a known issue?
     
  2. Sky77

    Sky77

    Joined:
    Jan 30, 2014
    Posts:
    171
    It's probably thermal throttling, since AR is quite heavy also on the most powerful hardware.
    In our experience, sustaining 60fps without throttling is basically impossible if not in a very simple scene.
    We're currently capping at 30fps with V-sync and we avoid throttling altogether.
     
    Aaron-Meyers likes this.
  3. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    305
    Ah makes sense yea... it is a bit of a heavy scene. Wish I could avoid the laggy motion of the camera panning at 30fps though :(
     
  4. distastee

    distastee

    Joined:
    Mar 25, 2014
    Posts:
    66
    Yeah it's definitely thermal throttling. There's some good resources online related to optimizing your app. Most apps run at 30fps which looks like garbage buuuuuut it might have to do. Snapchat + Insta run at 30fps and cover it up with motion blur. The other thing to do is lower the resolution of your app. If you don't set the res - it defaults to device resolution which is ENTIRELY too high. Even at half res the AR looks great.
     
  5. blanx

    blanx

    Joined:
    Feb 26, 2016
    Posts:
    73
    Maybe it would make sense to render the result of the AR camera to a render texture at lower resolution and keep an UI camera at full resolution for better readability?
    Did not test it yet if the render texture has a performance hit.
     
  6. distastee

    distastee

    Joined:
    Mar 25, 2014
    Posts:
    66
    I've been thinking this + rendering the camera at 30fps and the UI at 60fps. However I haven't actually delved into implementation so I have no idea how difficult it would be.
     
  7. Sky77

    Sky77

    Joined:
    Jan 30, 2014
    Posts:
    171
    We're using the LWRP and we set a lower Render Scale. In this way you get native resolution AR camera and UI, but lower resolution 3D rendering.
    Works great for us.