Version: Unity 6 Preview (6000.0)
Language : English
Render passes in the Deferred rendering path in URP
Limitations of the Deferred rendering path in URP

G-buffer layout in the Deferred rendering path in URP

This section describes how Unity stores material attributes in the G-buffer in 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
.

The following illustration shows the data structure for each 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
of the render targets that Unity uses in the Deferred Rendering Path.

Data structure of the render targets that Unity uses in the Deferred Rendering Path
Data structure of the render targets that Unity uses in the Deferred Rendering Path

The data structure consists of the following components.

Albedo (sRGB)

This field contains the albedo color in sRGB format, 24 bits.

MaterialFlags

This field is a bit field that contains Material flags:

  • Bit 0, ReceiveShadowsOff: if set, the pixel does not receive dynamic shadows.

  • Bit 1, SpecularHighlightsOff: if set, the pixel does not receive specular highlights.

  • Bit 2, SubtractiveMixedLighting: if set, the pixel uses subtractive mixed lighting.

  • Bit 3, SpecularSetup: if set, the Material uses the specular workflow.

Bits 4–7 are reserved for future use.

For more technical details, check the file /ShaderLibrary/UnityGBuffer.hlsl.

Specular

This field contains the following values:

  • SimpleLit Material: RGB specular colorThe color of a specular highlight.
    See in Glossary
    stored in 24 bits.

  • Lit Material with metallic workflow: reflectivity stored in 8 bits, 16 bits are not used.

  • Lit Material with specular workflow: RGB specular color stored in 24 bits.

Occlusion

This field contains the baked occlusion value from the baked lighting. For real-time lighting, Unity calculates the ambient occlusionA method to approximate how much ambient light (light not coming from a specific direction) can hit a point on a surface.
See in Glossary
value by combining the baked occlusion value with the SSAO value.

Normal

This field contains the world space normals encoded in 24 bits. For information on the encoding of normals, refer to Encoding of normals in G-buffer.

Smoothness

This field stores the smoothness value for the SimpleLit and Lit materials.

Emissive/GI/Lighting

This render target contains the Material emissive output and baked lighting. Unity fills this field during the G-buffer Pass. During the deferred shadingA rendering path in the Built-in Render Pipeline that places no limit on the number of Lights that can affect a GameObject. All Lights are evaluated per-pixel, which means that they all interact correctly with normal maps and so on. Additionally, all Lights can have cookies and shadows. More info
See in Glossary
pass, Unity stores lighting results in this render target.

Render target format:

  • B10G11R11_UFloatPack32, unless one of the following conditions is true:

    • In URP Asset, the setting Quality > HDR is turned on, and the target Player platform does not support HDR.

    • In Player SettingsSettings that let you set various player-specific options for the final game built by Unity. More info
      See in Glossary
      , the setting PreserveFramebufferAlpha is true.

  • R16G6B16A16_SFloat, if Unity cannot use B10G11R11_UFloatPack32 because of the project settingsA broad collection of settings which allow you to configure how Physics, Audio, Networking, Graphics, Input and many other areas of your project behave. More info
    See in Glossary
    .

  • If Unity cannot use one of the other formats in the list, it uses what the following method returns: SystemInfo.GetGraphicsFormat(DefaultFormat.HDR).

ShadowMaskA Texture that shares the same UV layout and resolution with its corresponding lightmap. More info
See in Glossary

Unity adds this render target to the G-buffer layout when Lighting Mode is set to Subtractive or Shadow mask.

The Subtractive and the Shadow mask modes are optimized for 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, and are less efficient in the Deferred Rendering Path. In the Deferred Rendering Path, avoid using these modes and use the Baked Indirect mode instead to improve GPU performance.

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

Unity adds this render target to the G-buffer layout when the Use Rendering Layers option is enabled (URP Asset, Lighting > Use Rendering Layers).

Using Rendering Layers might have an impact on the GPU performance. For more information, refer to the documentation on Rendering Layers.

Depth as Color

Unity adds this render target to the G-buffer layout when Native Render Pass is enabled on platforms that support it. Unity renders depth as a color into this render target. This render target has the following purpose:

  • Improves performance on Vulkan devices.

  • Lets Unity get the depth bufferA memory store that holds the z-value depth of each pixel in an image, where the z-value is the depth for each rendered pixel from the projection plane. More info
    See in Glossary
    on Metal API, which does not allow fetching the depth from the DepthStencil buffer within the same render pass.

The format of the Depth as Color render target is GraphicsFormat.R32_SFloat.

DepthStencil

Unity reserves the four highest bits of this render target to mark the Material type. Also check URP Pass tags: UniversalMaterialType.

For this render target, Unity selects either the D32F_S8 format, or the D24S8 format depending on the platform.

Encoding of normals in G-buffer

In the Deferred Rendering Path, Unity stores normals in the G-buffer. Unity encodes each normal as a 24 bit value.

When you select the Deferred option in the Rendering Path property in the URP Universal Renderer asset, Unity shows the Accurate G-buffer normals property.

The Accurate G-buffer normals property in the URP Universal Renderer asset
The Accurate G-buffer normals property in the URP Universal Renderer asset

The Accurate G-buffer normals property lets you configure how Unity encodes the normals.

  • Accurate G-buffer normals off: Unity stores values of normal vectors in the G-buffer in the RGB channel of a normal texture, 8 bit per value (x, y, z). The values are quantized with the loss of accuracy. This option increases performance, especially on mobile GPUs, but might lead to color banding artifacts on smooth surfaces.

  • Accurate G-buffer normals on: Unity uses the octahedron encoding to store values of normal vectors in the RGB channel of a normal texture. With this encoding, values of normal vectors are more accurate, but the encoding and decoding operations put extra load on the GPU. This option does not support decal normal blending when used with the Screen Space decal technique.
    The precision of the encoded normal vectors is similar to the precision of the sampled values in the Forward Rendering Path.

The following illustration shows the visual difference between the two options when the CameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary
is very close to the GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
:

Accurate G-buffer normals, visual difference between the two options.
Accurate G-buffer normals, visual difference between the two options.
Render passes in the Deferred rendering path in URP
Limitations of the Deferred rendering path in URP