Version: Unity 6 (6000.0)
Language : English
G-buffer layout in the Deferred rendering path in URP
Make a shader compatible with the Deferred rendering path in URP

Limitations of the Deferred rendering path in URP

This page describes the limitations of the Deferred Rendering PathThe technique that a render pipeline uses to render graphics. Choosing a different rendering path affects how lighting and shading are calculated. Some rendering paths are more suited to different platforms and hardware than others. More info
See in Glossary
.

Terrain blending

When blending more than four TerrainThe landscape in your scene. A Terrain GameObject adds a large flat plane to your scene and you can use the Terrain’s Inspector window to create a detailed landscape. More info
See in Glossary
layers, the Deferred Rendering Path generates slightly different results from the Forward RenderingA rendering path that renders each object in one or more passes, depending on lights that affect the object. Lights themselves are also treated differently by Forward Rendering, depending on their settings and intensity. More info
See in Glossary
Path. This happens because in the Forward Rendering Path, Unity processes the first four layers separately from the next four layers using multi-pass rendering.

In the Forward Rendering Path, Unity merges Material properties and calculates lighting for the combined properties of four layers at once. Unity then processes the next four layers in the same way and alpha-blends the lighting results.

In the Deferred Rendering Path, Unity combines Terrain layers in the G-buffer pass, four layers at a time, and then calculates lighting only once during the deferred rendering pass. This difference with the Forward Rendering Path leads to visually different outcomes.

Unity combines the Material properties in the G-buffer using hardware blending (four layers at a time), which limits how correct the combination of property values is. For example, pixelThe smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info
See in Glossary
normals cannot be correctly combined using the alpha blend equation alone, because one Terrain layer might contain coarse Terrain detail while another layer might contain fine detail. Averaging or summing normals results in loss of accuracy.

Note: Turning the setting Accurate G-buffer normals on breaks Terrain blending. With this setting turned on, Unity encodes normals using octahedron encoding. Normals in different layers encoded this way cannot be blended together because of the bitwise nature of the encoding (2 x 12 bits). If your application requires more than four Terrain layers, turn the Accurate G-buffer normals setting off.

The following illustration shows the visual difference when rendering Terrain layers with different Rendering Paths.

Terrain layers rendered with the Forward Rendering Path
Terrain layers rendered with the Forward Rendering Path

Terrain layers rendered with the Deferred Rendering Path
Terrain layers rendered with the Deferred Rendering Path

Baked Global Illumination and Lighting Modes

When Baked Global IlluminationA group of techniques that model both direct and indirect lighting to provide realistic lighting results.
See in Glossary
is enabled, the Subtractive and the ShadowmaskA Texture that shares the same UV layout and resolution with its corresponding lightmap. More info
See in Glossary
Lighting modes put extra load on the GPU in the Deferred Rendering Path.

The Deferred Rendering Path supports the Subtractive and the Shadowmask Lighting modes for compatibility reasons, but, unlike the case with the Forward Rendering Path, these modes do not provide any improvements in performance. In the Deferred Rendering Path, Unity processes all meshes using the same Lighting algorithm and stores the extra Lighting properties required by Subtractive and the Shadowmask modes in the ShadowMask render target.

In the Deferred Rendering Path, the Baked Indirect Lighting mode provides better performance, since it does not require the ShadowMask render target.

Rendering layers

URP implements the Rendering Layers feature that lets you configure which Lights in a sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
affect specific meshes. Lights assigned to a specific Rendering Layer only affect the meshes assigned to the same Rendering Layer.

For more information on Rendering Layers, refer to the documentation on Rendering Layers.

Performance impact

The Rendering Layers feature requires an extra G-buffer render target to store the rendering layer maskA value defining which layers to include or exclude from an operation, such as rendering, collision or your own code. More info
See in Glossary
(32 bits). The extra render target is likely to have a negative impact on GPU performance.

Implementation notes

In the Forward Rendering Path, the LayersLayers in Unity can be used to selectively opt groups of GameObjects in or out of certain processes or calculations. This includes camera rendering, lighting, physics collisions, or custom calculations in your own code. More info
See in Glossary
feature lets you tell Unity to render specific meshes with a specific set of Lights. The Layers feature uses the culling maskAllows you to include or omit objects to be rendered by a Camera, by Layer.
See in Glossary
system.

The Deferred Rendering Path cannot use the layer system with light culling masks, because the shading is deferred to a later stage in the rendering loop (check the Deferred rendering (stencil) step in the Deferred Rendering Path render Passes table.)

G-buffer layout in the Deferred rendering path in URP
Make a shader compatible with the Deferred rendering path in URP