Search Unity

EarlyUpdate.TangoUpdate performance

Discussion in 'AR' started by Flarup, Mar 18, 2018.

  1. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    164
    Hello,


    We currently working on improving performance of our ARCore app. The biggest culprit at the moment is by far EarlyUpdate.TangoUpdate which takes about 28 ms on a Galaxy S8 device. We're using ARCore 1.0 and Unity 2017.3.0f3.

    Is it expected that EarlyUpdate.TangoUpdate is taking so long, or are we doing something wrong?

    In the Unity profiler we unfortunately cannot "open" EarlyUpdate.TangeUpdate and investigage further what is time-consuming.

    Thank you very much in advance for all your help.


    Kind regards,
    Uffe Flarup
     
  2. tdmowrer

    tdmowrer

    Joined:
    Apr 21, 2017
    Posts:
    605
    Try disabling "Match Camera Framerate" in your Session Config (or change line 92 of ARCoreInterface.cs to false if you're using ARInterface).

    That timer wraps the entire ARCore update, which, if set to match the camera framerate, will wait for the next camera image to be available before continuing.
     
  3. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    164
    After much testing I've isolated the problem to the Ambient Occlusion postprocessing filter. Running an almost empty ARCore scene (e.g. the HelloAR scene distributed in the package) runs smoothly 60 fps on Galaxy S8. Running a simple scene WITHOUT ARCore, but WITH Ambient Occlusion also runs 60 fps on Galaxy S8.

    However, as soon as I stick Ambient Occlusion postprocessing filter on the camera in a scene with ARCore, then framerate drops to 30, and it's EarlyUpdate.TangoUpdate that takes between 20-30 msecs per frame.

    Any idea what's causing ARCore and Ambient Occlusion to work so poorly together?

    I can't get more info out of the profiler, since I can't open up TangoUpdate and see what's taking 20-30 msecs per frame.

    Thanks a lot in advance for all your help.


    Kind regards,
    Uffe Flarup
     
  4. tdmowrer

    tdmowrer

    Joined:
    Apr 21, 2017
    Posts:
    605
    I can't provide much more insight into that timer -- it's a single C function in ARCore.

    That's interesting that a post processing filter had that effect. I'll see if I can found out why that would be. Did you also experiment with the "match camera framerate" option? It made a huge difference for me.
     
  5. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    164
    Oh yes - I also experimented with the "match camera framerate" option. Unchecking that option enabled the HelloAR scene from the ARCore package to run at 60 fps instead of 30 fps.

    I'm also looking into why the post processing AO filter has such a signifacant negative impact on TangoUpdate function.
     
  6. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    164
    So, have been testing this some more.... even in the HelloAR scene from the ARCore package, if you add the AO post processing filter, then EarlyUpdate.TangeUpdate takes a SEVERE performance hit. It goes from taking a few msecs per frame till more than 20 msecs per frame. I haven't been able to find a fix for it.

    Any suggestions on how to fix this is very much appreciated.

    Thanks a lot in advance!


    Kind regards,
    Uffe Flarup
     
  7. alonlevi

    alonlevi

    Joined:
    Apr 22, 2019
    Posts:
    11
    Hi, did you find any solution?
    I might add another odd situation - when adding post processing anti aliasing, the ARCore camera loses it's connection and starts to float around it's own tracking... really strange.
     
  8. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    164
    @alonlevi Haven't looked into the issue since my previous post. We started using shadowmaps instead of AO postprocessing, so I haven't looked into it since then.
     
  9. Fik-shun

    Fik-shun

    Joined:
    Jun 6, 2020
    Posts:
    3
  10. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    164
    Not here unfortunately. Haven't looked into the issue for quite a while.