Performance optimization

published on: 2022-04-29 23:31:54

6.1 Multi-scene Configuration Instruction

  1. After adding the Pvr_UnitySDK prefab to the scene, it is needed to delete Main Camera of Unity.
  2. If there are many scenes in the project, when the Pvr_UnitySDK prefab is put into the main scene, “DontDestroyOnLoad” method needs to be added for the prefab. This can guarantee that there exists only one Pvr_UnitySDK prefab when switching scenes.

6.2 Frame rate and scenes requirements

Frame rate:

Frame rate for G2 4K should be no less than 30 frames and more than 45 frames is recommended. Frame rate for Neo 2 should be more than 60. Frame rate for Neo3 should be 72.

Scenes:

The triangular patch of the model being rendered in the camera view is controlled within 100,000

The amount of model vertices being rendered in the camera view is controlled within 100,000

The amount of common unity lights such as electric light sources is controlled within 50

The amount of ordinary unity particle systems is controlled within 50

Try to use the more efficient Unity shader

Examples of optimization methods:

Reduce the amount of fixed points on model faces when guaranteed to be displayed

Share the material and animation

Use a compressed texture format

Use as few lighting effects as possible

Use static batch processing

Optimize scripts to reduce complexity. Limit memory usage, CPU usage and other resource consumption

6.3 Advanced rendering methods

6.3.1 Foveated Rendering

Foveated rendering optimizes the ability to render scenes by providing high resolution for the center of the field of view, and greatly reducing peripheral views the details of the scene.

For more information, see: Chapter 8.7 Foveated Rendering.

6.3.2 VR Compositor Layers

VR Compositor Layers is more useful when rendering messages, text, videos which are used as “Focus of the Scene”. Meanwhile it can also be used for simple scenes and backgrounds.

For more information, see: Chapter 8.8 VR Compositor Layers.

6.3.3 Monocular Camera

Use a single image to render to both eyes, which effectively reduces rendering.

For more information, see: Chapter 8.9 Monocular Camera

6.3.4 SinglePass

SinglePass is based on native Unity SinglePass feature. It uses one camera to fulfill stereo rendering, reducing half of Draw Call and Occlusion Culling. Using this feature can increase frame rate dramatically in complex scenes. But SinglePass don’t support post processing. This option will take effect in all scenes.

For more information, see: Chapter 8.12 SinglePass

6.3.5 URP Configuration

For URP related information, see here.

Here, Unity 2019.4.2f1 is taken as an example.

  1. Open Window/Package Manager

_images/3.5.PNG

Figure 6.1 Window toolbar

  1. Select Show preview packages

_images/3.6.PNG

Figure 6.2 The advanced option of Packages

  1. Under “Universal PR” , click Install in the bottom right.

_images/3.7.PNG

Figure 6.3 Install the URP

  1. Create Universal Render Pipeline Asset

_images/3.8.PNG

Figure 6.4 Create URP Asset

  1. Use UniversalRenderPipelineAsset

Drag and drop the file created in step 4 to Scriptable Render Pipeline Setting field in Project Setting/Graphics

_images/3.9.PNG

Figure 6.5 Use URP Asset

  1. Replace materials in the project with URP materials

_images/3.10.PNG

Figure 6.6 Update materials in the project

6.4 Mitigate HMD overheating

  1. Check the current frame rate on VR application.

To turn on real-time display of frame rate using Pvr_UnitySDK, follow the instructions in Chapter 8.1 Display frame rate.

Another approach to enable real-time display of frame rate on the device. Go to 2D Settings -> System -> User configuration. Under Special Settings, turn on Info of the VR frame rate.

  1. Limit the frame rate in the Inspector panel of Pvr_UnitySDK and Chapter 8.3 Limited frame rate is for the reference.
  2. Enable Foveated Rendering. Setting the Foveation Level to High is recommended.

Pixel Light Count:1

Texture Quality:Full Res

Anisotropic Textures:Per Texture

Anti Aliasing:2x

Soft Particles:Disable

Realtime Reflections Probes:Disable

Billboards Face Camera Position:Disable

Scripting Backend:IL2CPP

Target Architectures:ARM64

The following content is the best practice of Pico team. To mitigate the blurring or flickering of some UI components, we suggest you adjust the value of Dynamic Pixels Per Unit in the Canvas Scaler in accordance with the following formula.

_images/6.6.png

Figure 6.7 Canvas Scaler

Formulas for Recommended Settings:

L=distance*tan(fov/2)*2

N=1/Scale

PPU=EyeBuffer/(L*N)

Notes:

Distance - the distance between Canvas and Camera

Fov - Field of View (the default Fov of G2 4K series and Neo 2 is 101 degree,Neo 3 is 98 degree)

Scale - the Scale value of the current Canvas

EyeBuffer - RenderTextureSize for the current setting