banner



How To Change Animation Fps In Unity

Framerate and Performance Optimization

Accommodate functioning-intensive augmented reality apps by setting the performance mode or managing the framerate. Adjusting these settings may result in video on see-through devices running smoother and cause less overheating due to processing and rendering loads.

If the device becomes too hot, the operating system may throttle the app to avoid overheating. Therefore, Vuforia allows you to dynamically suit the framerate of your digital eyewear app in response to its runtime requirements. You lot can balance runtime performance confronting computational load and power consumption, giving you control of your app's performance characteristics.

The recommended framerate API is intended for use with video see-through eyewear devices, to adjust the framerate devices running augmented reality apps.

Optimization tin be achieved in ii ways in Unity and Native:

  • Operation Mode
  • Framerate Management
  • Setting the Operation Manner and Framerate in Unity
  • Setting the Operation Mode and Framerate in Native

Performance Mode

When developing apps for Microsoft HoloLens or other video run into-through devices there may be situations where the AR experience should last for a longer duration or you need to minimize Vuforia Engine impact on the CPU to permit your own algorithms more fourth dimension. To limit the extent that the experience may exist cutting short by battery depletion or performance throttling, a performance fashion can be set in the Vuforia Engine API and in the Unity inspector.

Enumerator

MODE_DEFAULT All-time compromise betwixt speed and quality.
MODE_OPTIMIZE_SPEED Minimize Vuforia Engine impact on the system.
MODE_OPTIMIZE_QUALITY Optimize for Vuforia Engine performance. Application performance could get downwardly.

Past default,MODE_DEFAULT is used. Change the mode toMODE_OPTIMIZE_SPEED if the Vuforia Engine performance in this way meets your needs. If you look the target to be moved continuously, we recommend using in the default mode.

Framerate Management

The Vuforia API provides thegetRecommendedFps andsetTargetFps methods to obtain and adapt to a recommended return framerate based on your app's rendering and functioning requirements. To set a target framerate, call these methods when initializing the app.

ThegetRecommendedFPS method accepts i or more hints equally arguments. The post-obit are the hint flags available for configuring the FPS recommendation:

Hint Flags

Description

FPSHINT_FAST The fastest framerate bachelor for the device and firmware combination. The application uses content that requires a high rendering rate, e.g. smooth grapheme animation or a physics engine that requires frequent updates.
FPSHINT_NO_VIDEOBACKGROUND The application does not depict the video background (in optical see- through AR or if you have some non-AR/3D mode). Do not fix this flag when in video see- through AR mode.
FPSHINT_NONE No hint is applied.
FPSHINT_POWER_EFFICIENCY

The application should be conservative in its ability consumption, in club to reduce heat accumulation and increment bombardment life.

On some devices this may come at the cost of reduced awarding performance and decreased quality of feel.

FPSHINT_DEFAULT_FLAGS Default flags used by Vuforia to decide FPS settings.

Manage the maximum framerate on the video see-through device by using the below tabular array for recommended settings for each device. By and large, rendering on the HoloLens ever 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.

NOTE:These are but recommended settings. For short AR experiences (less than ten minutes), information technology'due south possible to render at 60 fps:

Eyewear/Mobile Device

Target Render
FPS

Hints to use in
getRecommendedFps(hints);

HoloLens 60 FAST
Mobile Device 30 POWER_EFFICIENCY
Mobile Device 30
(60 on some iOS devices)
NONE
Mobile Device 60 FAST

Setting Performance Style and Framerate in Unity

Setting Operation Way in Unity

The operation mode is found in Unity netherCamera Device Mode inVuforia Configuration in the Inspector Window ofARCamera GameObject . Locate theCamera Device Style dropdown menu and select one of the three possible modes.

Setting the Framerate in Unity

The following code cake queries Vuforia for the recommended frame rate and sets it using Unity'due south Awarding.targetFrameRate API:

                                          private void OnVuforiaStarted() {     // Query Vuforia for recommended frame rate and set information technology in Unity     int targetFps = VuforiaRenderer.Instance.GetRecommendedFps(VuforiaRenderer.FpsHint.NONE);       // By default, nosotros use Application.targetFrameRate to set the recommended frame rate.     // If developers apply vsync in their quality settings, they should besides set their     // QualitySettings.vSyncCount according to the value returned above.     // e.g: If targetFPS > 50 --> vSyncCount = 1; else vSyncCount = 2;     if (Application.targetFrameRate != targetFps)     {         Debug.Log("Setting frame rate to " + targetFps + "fps");         Application.targetFrameRate = targetFps;     } }                  

Setting Performance Mode and Framerate in Native

Setting Performance Mode

Delight refer to the following lawmaking examples to change the Photographic camera Device Mode in native. Changing the mode should be done afterVuforia::CameraDevice::getInstance().init() and beforeVuforia::CameraDevice::getInstance().showtime().

                                          // Select the default photographic camera style: if (!Vuforia::CameraDevice::getInstance().selectVideoMode(     Vuforia::CameraDevice::MODE_DEFAULT))     return false;                  

or

                    // Select the default camera mode: if (!Vuforia::CameraDevice::getInstance().selectVideoMode(     Vuforia::CameraDevice::MODE_OPTIMIZE_SPEED))     return false;                  

Setting the Framerate

Sets the recommended FPS to NONE unless running on an optical see-through device:

                    private boolean configureRenderingFrameRate()     {                      // In this instance we selected the default preset hint for all-time Mobile AR Experience         // See website documentation for more information on the rendering hint modes          // relevant to your AR feel.         int myRenderingOptions = Renderer.FPSHINT_FLAGS.FPSHINT_NONE;            // Retrieve recommended rendering frame rate best on currently configured/enabled vuforia features         // and selected application hint         int vuforiaRecommendedFPS =  Renderer.getInstance().getRecommendedFps(myRenderingOptions);                // Employ the recommended fps value computed by Vuforia         if (!Renderer.getInstance().setTargetFps(vuforiaRecommendedFPS))         {             Log.e(LOGTAG,"Failed to set rendering frame rate to: " + vuforiaRecommendedFPS + " fps");                return false;         }         else         {             Log.i(LOGTAG,"Configured frame rate gear up to recommended frame charge per unit: " + vuforiaRecommendedFPS + " fps");                 }            return true;     }                  

Source: http://library.vuforia.com/articles/Solution/Framerate-Optimization-for-Mixed-Reality-Apps.html

Posted by: moodyolded1943.blogspot.com

0 Response to "How To Change Animation Fps In Unity"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel