Version: Unity 6.5 (6000.5)
Language : English
Foveated rendering support reference
Enable and control foveated rendering

Foveated rendering shader compatibility workflow

Foveated rendering lowers the rendering resolution at the periphery of the display. On XR platforms that use variable rate rasterization (VRR), the pixels Unity renders no longer form a regular grid. A shader that performs screen-space calculations can therefore sample the wrong part of a texture and produce visible artifacts.

This workflow is for projects that contain custom shaders or shader graphs. Shaders that don’t sample in screen space need no changes. Neither do the shaders that Unity and the Universal Render Pipeline (URP) provide, because they already use the foveated rendering macros. For an explanation of the linear and non-uniform raster spaces, refer to Introduction to foveated rendering.

To make your shaders compatible with foveated rendering, complete the following tasks:

  1. Adapt custom shaders that you wrote in HLSL.
  2. Update shader graph effects that you built in Shader Graph.

Prerequisites

Before you begin, make sure that:

Adapt custom shaders

Add the foveated rendering shader library to each custom shader that samples in screen space, then remap the coordinates that its calculations use. The library supplies conversion functions that return the coordinates unchanged when foveated rendering isn’t active. A single version of the shader therefore works on every platform.

Complete this task for every hand-coded shader in your project that performs screen-space calculations. For the step-by-step procedure, refer to Adapt custom shaders for foveated rendering.

Update shader graph effects

Shader graphs sample screen-space textures through the Screen Position node, and the node’s Mode setting determines which raster space it provides coordinates in. Select a mode that matches the texture you sample, or remap the coordinates with a Custom Function node when the effect depends on the Raw mode.

Complete this task for every shader graph in your project that samples a screen-space texture. For the step-by-step procedure, refer to Update shader graph effects for foveated rendering.

Additional resources

Foveated rendering support reference
Enable and control foveated rendering