Adaptive Quality dynamically changes rendering settings to maintain VR framerate while maximizing GPU utilization.

Only Compatible With Unity 5.4 and above

There are two goals:

  • Reduce the chances of dropping frames and reprojecting
  • Increase quality when there are idle GPU cycles

This script currently changes the following to reach these goals:

  • Rendering resolution and viewport size (aka Dynamic Resolution)

In the future it could be changed to also change the following:

  • MSAA level
  • Fixed Foveated Rendering
  • Radial Density Masking
  • (Non-fixed) Foveated Rendering (once HMDs support eye tracking)

Some shaders, especially Image Effects, need to be modified to work with the changed render scale. To fix them
pass 1.0f / VRSettings.renderViewportScale into the shader and scale all incoming UV values with it in the vertex
program. Do this by using Material.SetFloat to set the value in the script that configures the shader.

In more detail:

  • In the .shader file: Add a new runtime-set property value float _InverseOfRenderViewportScale and add vertexInput.texcoord *= _InverseOfRenderViewportScale to the start of the vertex program
  • In the .cs file: Before using the material (eg. Graphics.Blit) add material.SetFloat("_InverseOfRenderViewportScale", 1.0f / VRSettings.renderViewportScale)

Inspector Parameters

  • Draw Debug Visualization: Toggles whether to show the debug overlay.\n\n Each square represents a different level on the quality scale. Levels increase from left to right, the first green box that is lit above represents the recommended render target resolution provided by the current VRDevice, the box that is lit below in cyan represents the current resolution and the filled box represents the current viewport scale. The yellow boxes represent resolutions below the recommended render target resolution.\n The currently lit box becomes red whenever the user is likely seeing reprojection in the HMD since the application isn't maintaining VR framerate. If lit, the box all the way on the left is almost always lit red because it represents the lowest render scale with reprojection on.
  • Allow Keyboard Shortcuts: Toggles whether to allow keyboard shortcuts to control this script.\n\r The supported shortcuts are:\r Shift+F1: Toggle debug visualization on/off\r Shift+F2: Toggle usage of override render scale on/off\r Shift+F3: Decrease override render scale level\r * Shift+F4: Increase override render scale level
  • Allow Command Line Arguments: Toggles whether to allow command line arguments to control this script at startup of the standalone build.\n\r The supported command line arguments all begin with '-' and are:\r -noaq: Disable adaptive quality\r -aqminscale X: Set minimum render scale to X\r -aqmaxscale X: Set maximum render scale to X\r -aqmaxres X: Set maximum render target dimension to X\r -aqfillratestep X: Set render scale fill rate step size in percent to X (X from 1 to 100)\r -aqoverride X: Set override render scale level to X\r -vrdebug: Enable debug visualization\r * -msaa X: Set MSAA level to X
  • Msaa Level: The MSAA level to use.
  • Scale Render Viewport: Toggles whether the render viewport scale is dynamically adjusted to maintain VR framerate.\n\n If unchecked, the renderer will render at the recommended resolution provided by the current VRDevice.
  • Render Scale Limits: The minimum and maximum allowed render scale.
  • Maximum Render Target Dimension: The maximum allowed render target dimension.\n\n This puts an upper limit on the size of the render target regardless of the maximum render scale.
  • Render Scale Fill Rate Step Size In Percent: The fill rate step size in percent by which the render scale levels will be calculated.
  • Scale Render Target Resolution: Toggles whether the render target resolution is dynamically adjusted to maintain VR framerate.\n\n If unchecked, the renderer will use the maximum target resolution specified by maximumRenderScale.
  • Override Render Viewport Scale: Toggles whether to override the used render viewport scale level.
  • Override Render Viewport Scale Level: The render viewport scale level to override the current one with.

Class Variables

  • public readonly ReadOnlyCollection<float> renderScales - All the calculated render scales. The elements of this collection are to be interpreted as modifiers to the recommended render target resolution provided by the current VRDevice.
  • public static float CurrentRenderScale - The current render scale. A render scale of 1.0 represents the recommended render target resolution provided by the current VRDevice.
  • public Vector2 defaultRenderTargetResolution - The recommended render target resolution provided by the current VRDevice.
  • public Vector2 currentRenderTargetResolution - The current render target resolution.

Class Methods


public static Vector2 RenderTargetResolutionForRenderScale(float renderScale)

  • Parameters
    • float renderScale - The render scale to calculate the render target resolution with.
  • Returns
    • Vector2 - The render target resolution for renderScale.

Calculates and returns the render target resolution for a given render scale.


public float BiggestAllowedMaximumRenderScale()

  • Parameters
    • none
  • Returns
    • float - The biggest allowed maximum render scale.

Calculates and returns the biggest allowed maximum render scale to be used for maximumRenderScale given the current maximumRenderTargetDimension.


public override string ToString()

  • Parameters
    • none
  • Returns
    • string - The summary.

A summary of this script by listing all the calculated render scales with their corresponding render target resolution.


VRTK/Examples/039_CameraRig_AdaptiveQuality displays the frames per second in the centre of the headset view.
The debug visualization of this script is displayed near the top edge of the headset view.
Pressing the trigger generates a new sphere and pressing the touchpad generates ten new spheres.
Eventually when lots of spheres are present the FPS will drop and demonstrate the script.