Deferred Rendering

It's like normal rendering but a little later

Before there where vertex and pixel shaders the the graphical pipeline on a GPU was fixed. It was possible to use functions to tweak a few parameters in different places but overall things moved forward in the GPU in a set order. You gave it the vertices, it did rasterization, put some texture on it, added some lightning and then triangles with colors fell out at the other end. With the ability to use shaders at the different stages it is no longer necessary follow the strict order of the old fixed function pipelines. Lighting can be done in the vertex shader, in the pixelshader or deferred to a second drawcall where we only do lighting. Rendering that is similar to the way fixed function graphical pipeline worked is called forward rendering, other techniques that shift things around are called deferred rendering. You can read up on some Deferred rendering history (2004) at Rich Geldreich website.

Terminology

Pass: A pass is rendering of all the triangles in the scene.

Stages: Each step in rendering is called a stage. One or more of them can be a render pass that draw all the surfaces and update some information in the G-Buffer.

G-Buffer: The geometry buffer contains the data needed for the deferred rendering stages. It often need more then one render target to fit all data and it can get big.

L-Buffer: A buffer that accumulate the light of each pixel.

Forward Rendering - 19XY

The classic pipeline style is called forward rendering. When drawing the pixel shader texture and light the fragment and then it is written to the color buffer. So each triangle drawn need to have access to the lights that will affect it. On the CPU the geometry is grouped by what set of light affect them and each group is then drawn separately. This is easy for static light and geometry and harder when things start to move around. If a group is affected by more lights then can be used in single draw call blending need to be used and draw the geometry more then once.

for each object
    for each light that can affect object
        lighting += computeLighting(object, light)

Deferred shading - 2006

Shrek and S.T.A.L.K.E.R

Deferred shading has three stages and need a G-Buffer and light accumulation buffer.

Geometry stage

The first stage is a pass that fills in the G-buffer with all the material data and the things needed lighting. This makes the G-Buffer a bit large to fit in all the things needed.

Lightning stage

A bounding volume is rendered for each light and the pixel shader use the G-Buffer data to calculate the lightning for the light source. The light output of all lights is gathered into a the L-Buffer.

Shading stage

The final stage is the shading stage. It takes the G-Buffer and L-Buffer as input and merge them to the final color buffer. This can be done with a single full screen quad.

Deferred lighting (light pre-pass rendering) - 2007

Resistance: Fall of Man

Deferred lighting do an extra pass to lower the size and bandwith off the G-Buffer.

Geometry stage

This pass fills in the G-Buffer with the data needed for lighting only. It makes the G-Buffer smaller.

Lightning stage

The same as in deferred shading.

Shading stage

A pass that renders all geometry again but this time it can use the L-Buffer to light each pixel.

Re-cap of Deferred Lighting - 2013

Deferred Rendering - 2012

Parallelized Light Pre-Pass Rendering with the Cell Broadband Engine™ - 2010

Tech Feature: Prepass lightning - 2010

A bit more deferred – CryEngine3 - 2009

Deferred Shading Shines. Deferred Lighting? Not So Much. - 2009

Deferred Rendering Jämförelse mellan traditionell deferred rendering och light pre-pass rendering - 2009

GDC09 – Resistance 2 Prelighting - 2009

Light Pre-Pass: Knee-Deep - 2009

Prelighting - 2008

Light Pre-Pass Renderer - 2008

The Light Pre-Pass Renderer: Renderer Design for Efficient Support of Multiple Lights - 2009

Deferred lighting approaches - 2009

A Bizarre Way to do Real-time Lighting”, - 2009

Light Indexed Deferred Rendering - 2007

The first stage is a early-z pass used to fill in the depth values. The next stage renders the lights and write down the index of each light into a light buffer. The size of the buffer per fragments limits how many lights can be on a single fragment and also the whole screen. All the lights information then need to be put into a texture or constant where the last stage, a render pass can read it and use it to light the fragment.

Tiled deferred shading - 2011

Uncharted & Battlefield 3

Create a G-Buffer like in normal deferred shading. Split the screen into tiles and the sort lights into the tiles they touch in screen space. As a final step, for each fragment sample the gbuffer and the use the lights in the tile the fragment is in to light and shade the pixel.

Clustered deferred shading - 2012

Create a G-Buffer like in normal deferred shading. Sort the fragments into clusters and then sort lights into the clusters they touch in 3D. As a final step, for each fragment sample the gbuffer and the use the lights in the clusters the fragment is in to light and shade the pixel.

Tiled Light Trees - 2017

Thoughts on light culling for clustered shading - 2017

Forward+ and Clustered Shading - 2017

Clustered Forward vs Deferred Shading - 2016

Forward vs Deferred vs Forward+ Rendering with DirectX 11 - 2015

Implicit Clustered Deferred Shading - 2015

Practical Clustered Deferred And Forward Shading - 2013. Part 1 and Part 2.

Clustered Deferred and Forward Shading - 2012 http://youtu.be/6DyTk7917ZI

Practical Clustered Shading -

Tiled Forward / Forward+ - 2012

Dirt: Showdown & The Order: 1886

Bin lights into 2D tiles on the screen. Then a forward renderer use these bins in the pixel shaders to apply the lights.

Cull that cone! - 2017

Improved Culling for Tiled and Clustered Rendering - 2017

Improved Culling for Tiled and Clustered Rendering in Call of Duty: Infinite Warfare - 2017

Warnock Subdivision for Deferred Lighting - 2015

Rendering the Alternate History of The Order: 1886 - 2015

Tiled and Clustered Forward Shading -2012

Tiled Forward Shading Links - 2012

Tiled Shading - 2011

Deferred Texturing - 2013

Only a material Id and the data for lighting is written down to the G-Buffer. Then a full screen shader is used to read the id and texture the screen. The upside is that only areas that are really visible need to access the data for textures.

Transparency

Transparens i en deferred pipeline : - 2010

Lighting transparent surfaces with deferred shading. - 2012 Part I , Part II

Reference

Volume Tiled Forward Shading - 2017

Hybrid Deferred Rendering - 2013

Mythbusting: deferred rendering - 2011

Deferred rendering Part 1 and Part 2. - 2008

Deferred+: Next-Gen Culling and Rendering for Dawn Engine - 2016

Deferred Lighting in Uncharted 4 - 2016

Volumetric Global Illumination at Treyarch - 2016

New Deferred Rendering System on WaveEngine 2.0 - 2015

Bindless Texturing for Deferred Rendering and Decals - 2016

Pragmatic physically based rendering - 2015

V Buffer - Deferred Lighting Re-Thought - 2015

Real-time Lighting Via Light Linked List - 2014

Efficient Real-Time Shading with Many Lights - 2014 - Intro, Part 1, Part 2, Part 3 and Part 4.

Notes on real-time renderers - 2014

Tutorial - Deferred Rendering Shadow Mapping - 2013

A Sort-based Deferred Shading Architecture for Decoupled Sampling - 2013

Intersecting Lights with Pixels - 2012

An Evaluation of Deferred Shading Under Changing Conditions - 2010

Deferred Rendering for Current and Future Rendering Pipelines - 2010

An investigation of real-time deep G-Buffer applications in screen-space rendering

GBuffer helper – Packing integer and float together

A Primer On Efficient Rendering Algorithms & Clustered Shading - 2018

Deferred+: Next-Gen Culling and Rendering for Dawn Engine - 2016

A Primer On Efficient Rendering Algorithms & Clustered Shading - 2018

Deferred Adaptive Compute Shading - 2018

Thoughts on light culling: stream compaction vs flat bit arrays - 2019

Tiled Light Trees - 2017