skip to Main Content

I am developing an application which utilizes ARKit using Swift and ObjC together. There is an ARSession running (always with ARWorldTrackingConfiguration) and I am trying to utilize its features separately. So far I have implemented image tracking, QR detection and plane tracking. These are not active at the same time.

There is no SceneView. There is only one Metal view (MTKView), with my own shader in order to display frames that I receive from server and my camera feed on top of each other and apply filters to server data when necessary.

Problem is that the phone gets heated up really quickly. After 5 minutes or even less it turns into a fireball. Now I know that the operations I perform each frame (server communications and anchor management) are contributing into the problem but I have to, because of required business logic. I also know that tracking is CPU/GPU intensive. But how can I make it better, any suggestions?

Note: Currently testing on an iPhone 12 Pro Max.

2

Answers


  1. This is a tough one cause the symptom is probably due to unoptimized code. Since you said you have "required business logic" you might not get the chance to fix it. At this point I would just run some memory profiling templates like Activity Monitor or CPU counters. See if there is waisted computations that could reduce your energy usage.

    Other than that you could buy an iPhone cooler.https://arstechnica.com/gadgets/2021/12/razers-rgb-smartphone-cooler-attaches-to-iphones-with-magsafe/

    Login or Signup to reply.
  2. It is extremely unlikely to be your business logic that is incurring the majority of energy impact, unless your logic alone would be pinning CPU usage at 75% or above. The truth is that ARKit performs very heavy processing under the hood, and also utilizes hardware resources – 2 cameras (3 in your case with the LiDAR camera), ANE+Accelerometer for visual inertial odometry, and GPU and CPU (the latter being more heavily used).

    The best way to determine if you can do anything about this at all is to build a viewcontroller that simply runs a vanilla ARKit implementation with your rendering layer of choice, and observe the energy impact in the Debug Navigator within XCode — specifically click on Energy Impact and observe the breakdowns between Overhead, CPU, GPU, and Network (since you mentioned it). Note the difference between a vanilla ARKit instance and your full application, and decide what to do accordingly.

    If the baseline ARKit energy impact is simply too high for your use case, you can try disabling some features of ARWorldTrackingConfiguration (sceneReconstruction is heavy, for instance) or potentially use a different configuration type.

    Otherwise if your code proves to be a major part of the impact, then try reducing the number of frames/sec you process. You want ARKit to run at 60fps consistently so maybe only process every 3rd or 4th frame, for instance.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search