Version: Unity 6 (6000.0)
Language : English
Deferred rendering path in URP
G-buffer layout in the Deferred rendering path in URP

Render passes in the Deferred rendering path in URP

The following table shows the sequence of Render Pass events 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
.

Render Pass events Deferred Rendering Path Passes SSAO Renderer Feature Passes
BeforeRendering    
BeforeRenderingShadows    
AfterRenderingShadows    
BeforeRenderingPrePasses Depth, or depth and normal prepass (Forward only materials)  
AfterRenderingPrePasses    
BeforeRenderingGbuffer G-buffer Pass (GBufferPass)  
  Copy G-buffer depth texture  
AfterRenderingGbuffer   SSAO (optional)
BeforeRenderingDeferredLights  
  Deferred rendering (stencil)
AfterRenderingDeferredLights  
BeforeRenderingOpaques Opaque Forward-only Materials
AfterRenderingOpaques   SSAO and blending (optional)
BeforeRenderingSkybox    
AfterRenderingSkybox    
BeforeRenderingTransparents    
AfterRenderingTransparents    
BeforeRenderingPostProcessing    
AfterRenderingPostProcessing    
AfterRendering    

The following sections describe the Deferred Rendering Path render Passes.

Depth, or depth and normal prepass

In the Deferred Rendering Path, in the depth prepass or depth and normal prepass, Unity renders only the Materials that do not support the deferred rendering model. For example, Materials using the Complex Lit shaderA program that runs on the GPU. More info
See in Glossary
are such Materials.

In the Deferred Rendering Path, Unity does not use the depth prepass to generate a copy of 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
(this behavior is different in the Forward Rendering Path).

If the Universal Renderer has the SSAO Renderer Feature, Unity executes the depth and normal prepass. SSAO uses the screen-space depth and normal buffers to calculate 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
.

Optional passes: SSAO, SSAO with blending

If the Universal Renderer has the SSAO Renderer Feature, and the After Opaque option is disabled (the option is disabled by default), Unity executes the SSAO Pass at the AfterRenderingGbuffer event. The SSAO Renderer Feature calculates the SSAO texture. Unity samples this texture in the Deferred rendering Pass and in the Pass that renders Forward-only Materials.

Using this Pass order, Unity can combine the baked occlusion with the real-time occlusion from the SSAO Renderer Feature, and avoid double-darkening from the baked and the real-time ambient occlusion.

When the After Opaque option is enabled, Unity executes the SSAO and blending Pass at the AfterRenderingOpaques event, after rendering the Forward-only Materials. Unity then executes an extra full screen Pass to overlay the SSAO texture onto the Emissive/GI/Lighting buffer. This causes over-darkening of the areas that receive baked occlusion and real-time occlusion.

Forward-only Pass

Certain Unity shaders use lighting models that Unity cannot render in the Deferred Rendering Path.

Examples of such shaders:

  • Complex Lit: the Lighting model of this shader (for example, the Clear Coat effect) is too complex and extra Material properties cannot fit into the G-buffer.

  • Baked Lit and Unlit: these shaders do not calculate real-time lighting, that’s why Unity renders them into the Emissive/GI/Lighting buffer directly during the Forward-only pass. This is faster than evaluating the shaders in the Deferred rendering (stencil) pass.

  • Custom shaders: Unity renders the shaders that do not declare the Pass tags required by the Deferred Rendering Path as Forward-only. The required Pass tags are: LightMode, and UniversalMaterialType. For more information, refer to URP Pass tags.

Unity renders Materials with such shaders in 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. For the SSAO Renderer Feature to be able to calculate ambient occlusion for the Materials using the Complex Lit shader, Unity must render such Materials in the depth and normal prepass first. This is because Unity does not render those Materials in the G-buffer pass (GBufferPass). For more information, refer to URP Pass tags.

General implementation notes

For maximum platform compatibility, the URP Deferred Rendering Path uses the light stencil volume technique to render light volumes and apply 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
.

Deferred rendering path in URP
G-buffer layout in the Deferred rendering path in URP