Understand how to control the resolution in your untethered XRAn umbrella term encompassing Virtual Reality (VR), Augmented Reality (AR) and Mixed Reality (MR) applications. Devices supporting these forms of interactive applications can be referred to as XR devices. More info
See in Glossary project.
You can implement resolution scaling to reduce GPU workload and optimize performance of your XR project. Some methods of resolution control on XR devices implement dynamic resolution. Dynamic resolution adjusts the resolution automatically to maintain a stable frame rate.
The way you control the resolution in your XR project depends on the render pipelineA series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. More info
See in Glossary your project uses.
The following table lists the methods you can use to scale resolution in your XR project and which render pipeline each method is compatible with:
Method | Render pipeline compatibility |
---|---|
Control resolution with XRSettings.renderViewportScale | URP |
Change render scale in the URP Asset | URP |
Dynamic resolution system | HDRP |
Change the XRSettings.eyeTextureResolutionScale | HDRP |
If your project uses the universal render pipeline (URP), Unity recommends that you Control resolution with XRSettings.renderViewportScale. If your project uses post-processing, you can use the XRSettings.renderViewportScale
with additional set up as outlined in Use XRSettings.renderViewPortScale with post-processing enabled.
You can also Change render scale in the URP Asset, but this is an expensive method.
URP renders directly to the eye texture when you don’t enable post-processingA process that improves product visuals by applying filters and effects before the image appears on screen. You can use post-processing effects to simulate physical camera and film properties, for example Bloom and Depth of Field. More info post processing, postprocessing, postprocess
See in Glossary methods, or when you enable HDRhigh dynamic range
See in Glossary. When URP renders directly to the eye texture, you can use XRSettings.renderViewportScale directly. XRSettings.renderViewportScale
controls how much of the allocated eye texture URP uses for rendering. You can change this value at runtime to dynamically adjust the eye render resolution.
Adjusting the renderViewPortScale
can be the best way to take advantage of dynamic resolution. You can change the viewportThe user’s visible area of an app on their screen.
See in Glossary scale every frame without the performance penalty of reallocating the eye textures.
To enable dynamic resolution, you can use XRSettings.renderViewportScale to control the portion of the allocated eye texture to which the rendering pipeline renders. For example, if you set a value of 0.5, then URP renders into one quarter of the texture (half the height and half the width). The XR device then scales this area to fill the final display. You can change the renderViewportScale
value at runtime to dynamically adjust the eye render resolution.
XRSettings.renderViewportScale
is compatible with fixed foveated rendering.
If you enable post-processing methods in your URP XR project, URP renders to intermediate textures rather than directly to the eye texture.
To enable dynamic resolution with intermediate textures:
Note: You can’t use this approach with fixed foveated rendering, or if you have enabled Temporal Anti Aliasing.
Change the URP render scale directly in your URP Asset to scale the eye texture directly. Reducing the value of the URP render scale can reduce the resolution. This method is an alternative to XRSettings.eyeTextureResolutionScale, which isn’t supported in URP but is supported in HDRP.
Important: Changing the render scale reallocates the eye texture, which is an expensive operation. You should not perform this operation every frame.
To change the render scale of your URP Asset:
You can also change this value with the UniversalRenderPipeline.asset.renderScale API.
If your project uses HDRP, you can use the dynamic resolution system or change the XRSettings.eyeTextureResolutionScale
as outlined in Configure HDRP for virtual reality.
Note: XRSettings.renderViewportScale
isn’t supported on HDRP.