Device Performance Optimization

Accommodate performance-intensive augmented reality (AR) apps by adjusting Vuforia Engine modes designed to lighten the impact on CPU and battery life.

Intensive AR apps can cause the device to become too hot, causing the operating system to throttle the app to avoid overheating. Therefore, Vuforia allows you to set the video mode of your device in response to the app’s runtime requirements. You can balance runtime performance against computational load and power consumption, giving you control of your app's performance characteristics.

Additional considerations

On the very first application startup, Vuforia Engine will download a device profile to optimize the performance on the specific device. This may add a few additional seconds during the initialization step. Also, be aware that large databases e.g., hundreds of Image Targets and complex Model Targets, or accompanying assets that are unoptimized for mobile devices can increase the initialization time of your application. See Comparison of Device and Cloud Databases for database types and usage.

Performance Mode

When developing apps for Microsoft HoloLens or other video see-through devices there may be situations where the AR experience should last for a longer duration, or you need to minimize Vuforia Engine’s impact on the CPU to allow your own algorithms more time. To limit the extent that the experience may be cut short by battery depletion or performance throttling, a camera mode can be set in the Vuforia Engine API and in the Unity inspector.

See Working with the Camera in Unity and Vuforia Engine Camera API Overview on setting camera modes.

Recommended Framerate Settings in Unity

 

The Vuforia Engine API for Unity provides the CameraDevice.GetRecommendedFPS() method to obtain and set a recommended render framerate based on your app's rendering and performance requirements. To set a target framerate, call these methods when initializing the app.

The getRecommendedFPS() returns the recommended framerate setting based on the device’s settings.

For video see-through devices, the below table shows the GetRecommendedFps() available on various device types. Generally, rendering on the HoloLens always needs to be at 60 fps, while AR rendering on a mobile handheld device can be at 30 fps or at 60 fps, depending on the device.

Eyewear/Mobile Device

Target Render
FPS

HoloLens 60
Magic Leap 60
Android Devices 30
iOS Device 60 (on most devices)

Set the Framerate in Unity

The following code block queries Vuforia for the recommended frame rate and sets it using Unity’s Application.targetFrameRate API:

using UnityEngine;
using Vuforia;

public class FrameRateSettings : MonoBehaviour
{
    void Start()
    {
        VuforiaApplication.Instance.OnVuforiaStarted += OnVuforiaStarted;
    }
    
    void OnVuforiaStarted()
    {
        // Query Vuforia for recommended frame rate and set it in Unity
        var targetFps = VuforiaBehaviour.Instance.CameraDevice.GetRecommendedFPS();

        // By default, we use Application.targetFrameRate to set the recommended frame rate.
        // If developers use vsync in their quality settings, 
	 // they should also set their QualitySettings.vSyncCount
        // according to the value returned above.
        // e.g: If targetFPS > 50 --> vSyncCount = 1; else vSyncCount = 2;
        if (UnityEngine.Application.targetFrameRate != targetFps)
        {
            Debug.Log("Setting frame rate to " + targetFps + "fps");
            UnityEngine.Application.targetFrameRate = targetFps;
        }
    }
}

Can this page be better?
Share your feedback via our issue tracker