Forward and Deferred rendering | High Definition RP | 14.0.11 (2024)

The High Definition Render Pipeline (HDRP) allows you to render Lit Materials using either Forward or Deferred rendering. You can configure your Unity Project to only use one of these modes, or allow it to use both and switch at runtime on a per-Camera basis.

Each rendering path uses a different set of steps to calculate lighting and draw objects. Which rendering path you choose affects the performance of your game and lighting options.

  • Forward rendering: HDRP draws each object one by one. For each object, HDRP checks every light that affects it to calculate how the object looks.
  • Deferred rendering: HDRP first renders information about every object into multiple buffers. Then in a later ('deferred') step, HDRP draws each screen pixel one by one by combining the information from the buffers.

Using Forward or Deferred rendering

Before you use forward or deferred rendering in your Unity Project, you must make sure your HDRP Asset supports them.

Forward and Deferred rendering | High Definition RP | 14.0.11 (1)

To set the default support for forward or deferred rendering in your Project:

  1. Select your HDRP Asset in the Project window to view it in the Inspector.
  2. Go to Rendering > Lit Shader Mode.
  3. Select one of the following Lit Shader modes:
Lit Shader ModeDescription
ForwardHDRP calculates the lighting in a single pass when rendering each individual GameObject.
DeferredHDRP renders the Material properties of every GameObject visible on screen into a GBuffer. HDRP then processes the lighting for every pixel in the frame.
BothUse the Frame Settings to change between Forward and Deferred rendering mode on a per Camera basis. Selecting this increases Project build time.

If you select Both, you can set the rendering mode at runtime for each Camera individually. For example, you can use Forward mode for a Planar Reflection Probe and then render your main Camera using Deferred mode.

To override the rendering mode for a specific Camera:

  1. Select the Camera in the Hierarchy window to view it in the Inspector
  2. Go to Rendering and enable Custom Frame Settings.
  3. Go to the Rendering section and enable Lit Shader Mode. You can use this to change the Lit Shader Mode for this Camera.
  4. Select the rendering mode you want this Camera to use.

Selecting a Lit Shader Mode

To decide if you want to use Forward or Deferred mode, consider the level of quality and performance you want for your Project. Deferred rendering in HDRP is faster in most scenarios, such as a Scene with various Materials and multiple local Lights. Some scenarios, like those with a single Directional Light in a Scene, can be faster in Forward rendering mode. If quality is more important than performance for your Project, use Forward rendering mode for better quality rendering.

HDRP enforces Forward rendering for the following types of Shaders:

  • Fabric
  • Hair
  • AxF
  • StackLit
  • Unlit
  • Lit Shader with a Transparent Surface Type

If you set the Lit Shader Mode to Deferred in your HDRP Asset, HDRP uses deferred rendering to render all Materials that use an Opaque Lit Material.

Forward and Deferred rendering both implement the same features, but the quality can differ between them. This means that HDRP works with all features for whichever Lit Shader Mode you select. For example, Screen Space Reflection, Screen Space Ambient Occlusion, Decals, and Contact Shadows work with a Deferred or Forward Lit Shader Mode. Although feature parity is core to HDRP, the quality and accuracy of these effects may vary between Lit Shader Modes due to technical constraints.

Differences between Forward and Deferred rendering in HDRP

FeatureForward RenderingDefferred
Normal shadow biasHDRP uses the geometric normal (the vertex normal) of the Material for shadow bias, so Forward Rendering produces fewer shadow artifacts.HDRP uses the pixel normal of the Material for shadow bias, so Deferred Rendering produces more shadow artifacts.
Emissive ColorAmbient Occlusion doesn't affect Emissive Color.Ambient Occlusion affects Emissive Color due to technical constraints.
Ambient OcclusionHDRP applies the minimum amount of Ambient Occlusion and Screen Space Ambient Occlusion to Lightmaps, Lightprobes, and Screen Space Global Illumination and Ray-traced global Illumination. This results in correct darkening.HDRP applies Ambient Occlusion on Lightmaps, Light Probes, and the Screen Space Ambient Occlusion effect. This results in incorrect darkening.
Material QualityThere is no compression, so there are no compression artifacts.HDRP compresses Material properties, such as normals or tangents, in the GBuffer. This results in compression artifacts.
Depth PrepassHDRP always renders a depth prepass, which outputs a depth and a normal buffer.A depth prepass is optional in Deferred mode if you aren't using Decals.
Normal BufferHDRP updates normal buffers after the decal DBuffer pass. HDRP uses the normal buffer for Screen Space Reflection and other effects.N/A

Build time

The build time for an HDRP Project may be faster when using either Forward or Deferred rendering. The downside of choosing a Lit Shader Mode of Both is that it increases the build time for the Player substantially because Unity builds two sets of Shaders for each Material, one for Forward and one for Deferred. If you use a specific rendering mode for everything in your Project, you should use that rendering mode instead of Both, to reduce build time. This also reduces the memory size that HDRP allocates for Shaders.

Tile and cluster rendering

HDRP uses tile and cluster rendering to speed up lighting calculations compared to the slower multi-pass lighting used in the Built-In Render Pipeline.

Forward and Deferred rendering | High Definition RP | 14.0.11 (2)

In tile and cluster rendering, the render pipeline subdivides rendering into the following:

  • Tiles, which are small square 2D sections of the display.
  • Clusters, which are 3D volumes inside the camera frustum.

For each tile or cluster, the render pipeline lists which lights affect it, then calculates the lighting in one pass using only the lights in the list.

HDRP usually uses tile rendering for opaque objects and cluster rendering for transparent objects.

Forward and Deferred rendering | High Definition RP | 14.0.11 (2024)

References

Top Articles
Latest Posts
Article information

Author: Laurine Ryan

Last Updated:

Views: 5961

Rating: 4.7 / 5 (57 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Laurine Ryan

Birthday: 1994-12-23

Address: Suite 751 871 Lissette Throughway, West Kittie, NH 41603

Phone: +2366831109631

Job: Sales Producer

Hobby: Creative writing, Motor sports, Do it yourself, Skateboarding, Coffee roasting, Calligraphy, Stand-up comedy

Introduction: My name is Laurine Ryan, I am a adorable, fair, graceful, spotless, gorgeous, homely, cooperative person who loves writing and wants to share my knowledge and understanding with you.