Deferred shading

Short description: Screen-space shading technique

This article's lead section may not adequately summarize its contents. To comply with Wikipedia's lead section guidelines, please consider modifying the lead to provide an accessible overview of the article's key points in such a way that it can stand on its own as a concise version of the article. (July 2013)

|

Diffuse Color G-BufferZ-BufferSurface Normal G-BufferFinal compositing (To calculate the shadows shown in this image, other techniques such as shadow mapping, shadow feelers or a shadow volume must be used together with deferred shading.)[1]

In the field of 3D computer graphics, deferred shading is a screen-space shading technique that is performed on a second rendering pass, after the vertex and pixel shaders are rendered.[2] It was first suggested by Michael Deering in 1988.[3]

On the first pass of a deferred shader, only data that is required for shading computation is gathered. Positions, normals, and materials for each surface are rendered into the geometry buffer (G-buffer) using "render to texture". After this, a pixel shader computes the direct and indirect lighting at each pixel using the information of the texture buffers in screen space.

Screen space directional occlusion[4] can be made part of the deferred shading pipeline to give directionality to shadows and interreflections.

## Contents

* 1 Advantages
* 2 Disadvantages
* 3 Deferred lighting
* 4 Deferred lighting in commercial games
* 5 Deferred shading in commercial games
* 6 Game engines featuring deferred shading or rendering techniques
* 7 History
* 8 References

## Advantages

The primary advantage of deferred shading is the decoupling of scene geometry from lighting. Only one geometry pass is required, and each light is only computed for those pixels that it actually affects. This gives the ability to render many lights in a scene without a significant performance hit.[5] There are some other advantages claimed for the approach. These include simpler management of complex lighting resources, ease of managing other complex shader resources, and the simplification of the software rendering pipeline.

## Disadvantages

One key disadvantage of deferred rendering is the inability to handle transparency within the algorithm, although this problem is a generic one in Z-buffered scenes and it tends to be handled by delaying and sorting the rendering of transparent portions of the scene.[6] Depth peeling can be used to achieve order-independent transparency in deferred rendering, but at the cost of additional batches and g-buffer size. Modern hardware, supporting DirectX 10 and later, is often capable of performing batches fast enough to maintain interactive frame rates. When order-independent transparency is desired (commonly for consumer applications) deferred shading is no less effective than forward shading using the same technique.

Another serious disadvantage is the difficulty with using multiple materials. It's possible to use many different materials, but it requires more data to be stored in the G-buffer, which is already quite large and takes up a large amount of the memory bandwidth.[7]

One more disadvantage is that, due to separating the lighting stage from the geometric stage, hardware anti-aliasing does not produce correct results anymore since interpolated subsamples would result in nonsensical position, normal, and tangent attributes. One of the usual techniques to overcome this limitation is using edge detection on the final image and then applying blur over the edges,[8] however recently more advanced post-process edge-smoothing techniques have been developed, such as MLAA[9][10] (used in Killzone 3 and Dragon Age II, among others), FXAA[11] (used in Crysis 2, FEAR 3, Duke Nukem Forever), SRAA,[12] DLAA[13] (used in Software:Star Wars: The Force Unleashed II), and post MSAA (used in Crysis 2 as default anti-aliasing solution). Although it is not an edge-smoothing technique, temporal anti-aliasing (used in Software:Halo: Reach and Unreal Engine) can also help give edges a smoother appearance.[14] DirectX 10 introduced features allowing shaders to access individual samples in multi-sampled render targets (and depth buffers in version 10.1), giving users of this API access to hardware anti-aliasing in deferred shading. These features also allow them to correctly apply HDR luminance mapping to anti-aliased edges, where in earlier versions of the API any benefit of anti-aliasing may have been lost.

## Deferred lighting

This section's factual accuracy is disputed. Please help to ensure that disputed statements are reliably sourced. (August 2016) (Learn how and when to remove this template message)

|

Deferred lighting (also known as Light Pre-Pass) is a modification of the Deferred Shading.[15] This technique uses three passes, instead of two in deferred shading. On first pass over the scene geometry, only normals and specular spread factor are written to the color buffer. The screen-space, “deferred” pass then accumulates diffuse and specular lighting data separately, so a last pass must be made over the scene geometry to output final image with per-pixel shading. The apparent advantage of deferred lighting is a dramatic reduction in the size of the G-Buffer. The obvious cost is the need to render the scene geometry twice instead of once. An additional cost is that the deferred pass in deferred lighting must output diffuse and specular irradiance separately, whereas the deferred pass in deferred shading need only output a single combined radiance value.

## Deferred lighting in commercial games

Use of the technique has increased in video games because of the control it enables in terms of using a large amount of dynamic lights and reducing the complexity of required shader instructions. Some examples of games using deferred lighting are:

* Alan Wake
* Assassin's Creed III[16]
* BioShock Infinite[17]
* Black Mesa [18]
* Blur
* Brink
* Crackdown and Crackdown 2[19]
* Crysis 2[20]
* Dead Space,[21] Dead Space 2[22] and Dead Space 3[23]
* Software:Deus Ex: Human Revolution [24]
* Dragon's Dogma [25]
* Guild Wars 2 [26]
* Software:Halo: Reach [27]
* inFamous and inFamous 2
* LittleBigPlanet
* Software:Metal Gear Solid V: Ground Zeroes
* Software:Metal Gear Solid V: The Phantom Pain[28]
* Minecraft (experimental)
* Red Dead Redemption
* Resistance series[29]
* Rochard
* Software:Shift 2: Unleashed [30]
* StarCraft II [31]
* Uncharted and Uncharted 2[32]
* Vanquish [33]
* Ghost of Tsushima [34]

## Deferred shading in commercial games

In comparison to deferred lighting, this technique is not very popular due to high memory size and bandwidth requirements, especially on seventh generation consoles where graphic memory size and bandwidth are limited and often bottlenecks.

* Software:Amnesia: The Dark Descent[35]
* Battlefield 3[36]
* Dota 2[37]
* Dungeons
* Digital Combat Simulator (DCS) World 2.5
* Grand Theft Auto IV
* Killzone 2 and Killzone 3[38]
* Mafia II
* Miner Wars 2081[39]
* Metro 2033[40]
* Rift
* Shrek[41]
* Splinter Cell: Conviction
* The S.T.A.L.K.E.R. game series: Shadow of Chernobyl, Clear Sky and Call of Pripyat[42]
* Tabula Rasa[43]
* Trine[44]
* Trine 2 [45]
* Viva Pinata

## Game engines featuring deferred shading or rendering techniques

* AnvilNext
* Chrome Engine
* CryEngine 3[46]
* Fox Engine[28]
* Frostbite 2[47]
* GameStart[48]
* Haemimont Games Engine (HGE)
* I-Novae[49]
* Leadwerks
* MT Framework
* Rockstar Advanced Game Engine[50]
* Torque 3D[51]
* Unity[52]
* Unreal Engine 4[53]
* Vision[54]
* Creation Engine as of Fallout 4 and Skyrim SE[55]
* Fusion Engine (early Illusion Engine) as of Mafia III and Software:Mafia: Definitive Edition

* Raylib[56]
* X-Ray Engine

## History

The idea of deferred shading was originally introduced by Michael Deering and his colleagues in a paper[3] published in 1988 titled The triangle processor and normal vector shader: a VLSI system for high performance graphics. Although the paper never uses the word "deferred", a key concept is introduced; each pixel is shaded only once after depth resolution. Deferred shading as we know it today, using G-buffers, was introduced in a paper by Saito and Takahashi in 1990,[57] although they too do not use the word "deferred". The first deferred shaded video game was Shrek, an Xbox launch title shipped in 2001.[58] Around 2004, implementations on commodity graphics hardware started to appear.[59] The technique later gained popularity for applications such as video games, finally becoming mainstream around 2008 to 2010.[60]

## References

1. ↑ Hargreaves, Shawn; Harris, Mark (2004). "6800 Leagues Under the Sea: Deferred Shading". http://http.download.nvidia.com/developer/presentations/2004/6800_Leagues/6800_Leagues_Deferred_Shading.pdf.
2. ↑ "Forward Rendering vs. Deferred Rendering". October 28, 2013. https://gamedevelopment.tutsplus.com/articles/forward-rendering-vs-deferred-rendering--gamedev-12342.
3. ↑ 3.0 3.1 Deering, Michael; Stephanie Winner; Bic Schediwy; Chris Duffy; Neil Hunt (1988). "The triangle processor and normal vector shader: A VLSI system for high performance graphics". ACM SIGGRAPH Computer Graphics 22 (4): 21–30. doi:10.1145/378456.378468.
4. ↑ O'Donnell, Yuriy (2011-07-18). "Deferred Screen Space Directional Occlusion". kayru.org. http://kayru.org/articles/dssdo/.
5. ↑ Kayi, Celal Cansin. "Deferred Rendering in XNA 4". http://homepage.lnu.se/staff/tblma/Deferred Rendering in XNA 4.pdf.
6. ↑ "SDK 9.51 – Featured Code Samples". 2007-01-17. http://download.nvidia.com/developer/SDK/Individual_Samples/featured_samples.html. Retrieved 2007-03-28.
7. ↑ Engel, Wolfgang (2008-03-16). "Light Pre-Pass Renderer". Diary of a Graphics Programmer. http://diaryofagraphicsprogrammer.blogspot.com/2008/03/light-pre-pass-renderer.html.
8. ↑ "Deferred shading tutorial". Pontifical Catholic University of Rio de Janeiro. Archived from the original on March 6, 2009. https://web.archive.org/web/20090306111435/http://www710.univ-lyon1.fr/~jciehl/Public/educ/GAMA/2007/Deferred_Shading_Tutorial_SBGAMES2005.pdf. Retrieved 2008-02-14.
9. ↑ "MLAA: Efficiently Moving Antialiasing from the GPU to the CPU". Intel. https://software.intel.com/sites/default/files/m/d/4/1/d/8/MLAA.pdf. Retrieved 2018-12-02.
10. ↑ "Morphological antialiasing and topological reconstruction". http://igm.univ-mlv.fr/~biri/mlaa-gpu/TMLAA.pdf.
11. ↑ "Archived copy". http://www.ngohq.com/images/articles/fxaa/FXAA_WhitePaper.pdf.
12. ↑ Chajdas, Matthäus G.; McGuire, Morgan; Luebke, David (2011-02-01). "Subpixel Reconstruction Antialiasing". Nvidia. http://research.nvidia.com/publication/subpixel-reconstruction-antialiasing.
13. ↑ Andreev, Dmitry (2011). "Anti-Aliasing from a Different Perspective". and.intercon.ru. http://and.intercon.ru/releases/talks/dlaagdc2011/.
14. ↑ Andreev, Dmitry (2011-03-04). "Anti-Aliasing from a Different Perspective (GDC 2011 Extended Slides)". and.intercon.ru. http://and.intercon.ru/releases/talks/dlaagdc2011/slides/.
15. ↑ "Real-Time Rendering · Deferred lighting approaches". realtimerendering.com. June 2, 2009. http://www.realtimerendering.com/blog/deferred-lighting-approaches/.
16. ↑ "Assassin's Creed III: The Redesigned Anvil Engine". Game Informer. https://www.gameinformer.com/b/features/archive/2012/03/28/ac-iii-the-redesigned-anvil-engine.aspx.
17. ↑ "BioShock Infinite development is PS3 focused and uses Uncharted 2 tech". blorge.com. Archived from the original on 2011-10-03. https://web.archive.org/web/20111003222842/http://gamer.blorge.com/2010/11/21/bioshock-infinite-development-is-ps3-focused-and-uses-uncharted-2-tech/.
18. ↑ Chetan Jags (18 July 2023). "BlackMesa XenEngine: Part 4 – Lighting & Shadows". https://chetanjags.wordpress.com/2023/07/18/blackmesa-xenengine-part-4-lighting-shadows/.
19. ↑ "Tech Interview: Crackdown 2". Eurogamer.net. 26 June 2010. http://www.eurogamer.net/articles/digitalfoundry-crackdown2-tech-interview.
20. ↑ guest11b095 (May 14, 2009). "A Bit More Deferred Cry Engine3". slideshare.net. http://www.slideshare.net/guest11b095/a-bit-more-deferred-cry-engine3.
21. ↑ "Dead Space by Electronic Arts". NVIDIA. http://nzone.com/object/nzone_deadspace_feature.html. Retrieved 2008-02-14.
22. ↑ "Face-Off: Dead Space 2". http://www.eurogamer.net/articles/digitalfoundry-dead-space-2-face-off. Retrieved 2010-02-01.
23. ↑ "Face-Off: Dead Space 3". February 18, 2013. http://www.eurogamer.net/articles/digitalfoundry-dead-space-3-face-off. Retrieved 2013-02-18.
24. ↑ "Google Translate". google.com. https://translate.google.com/translate?hl=en&sl=ja&tl=en&u=http://game.watch.impress.co.jp/docs/series/3dcg/20100922_395310.html.
25. ↑ "GregaMan, Manage Blog". capcom-unity.com. http://www.capcom-unity.com/gregaman/blog/2012/04/05/how_dragons_dogma_changed_the_mt_framework.
26. ↑ "Normals". Imgur. http://imgur.com/a/xEtnG.
27. ↑ "Tech Interview: Halo: Reach". Eurogamer.net. 11 December 2010. http://www.eurogamer.net/articles/digitalfoundry-halo-reach-tech-interview.
28. ↑ 28.0 28.1 "Tech Analysis: Metal Gear Solid 5's FOX Engine". Eurogamer.net. 5 April 2013. http://www.eurogamer.net/articles/digitalfoundry-tech-analysis-mgs5-fox-engine.
29. ↑ "Archived copy". Archived from the original on 2011-09-15. https://web.archive.org/web/20110915140642/http://cmpmedia.vo.llnwd.net/o1/vault/gdc09/slides/gdc09_insomniac_prelighting.pdf. Retrieved 2011-07-12.
30. ↑ "The Making of Shift 2 Unleashed Article • Page 2 • Eurogamer.net". Eurogamer.net. 14 May 2011. http://www.eurogamer.net/articles/digitalfoundry-the-making-of-shift-2?page=2.
31. ↑ "StarCraft II Effects & techniques". AMD. http://developer.amd.com/wordpress/media/2013/01/Chapter05-Filion-StarCraftII.pdf. Retrieved 2012-07-09.
32. ↑ "CGSociety Maintenance". cgsociety.org. http://features.cgsociety.org/story_custom.php?story_id=5545.
33. ↑ "Deferred Rendering « PlatinumGames Inc.". platinumgames.com. Archived from the original on 2010-11-27. https://web.archive.org/web/20101127091253/http://platinumgames.com/tag/deferred-rendering/.
34. ↑ "Ghost of Tsushima Analysis: A PS4 Graphics Powerhouse". gamingbolt.com. https://gamingbolt.com/ghost-of-tsushima-analysis-a-ps4-graphics-powerhouse/.
35. ↑ Silard Šimon. "Frictional Games interview". playsomnia.com. http://www.playsomnia.com/index.php?option=com_content&view=article&id=863:frictional-games-interview&catid=56:intervjui.
36. ↑ DICE (March 8, 2011). "SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3". slideshare.net. http://www.slideshare.net/DICEStudio/spubased-deferred-shading-in-battlefield-3-for-playstation-3.
37. ↑ "Valve Developer Wiki - Dota 2". http://developer.valvesoftware.com/wiki/Dota_2. Retrieved 10 April 2012.
38. ↑ "Archived copy". http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf.
39. ↑ Miner Wars 2081
40. ↑ "Tech Interview: Metro 2033 Interview • Page 2 • Eurogamer.net". Eurogamer.net. 25 February 2010. http://www.eurogamer.net/articles/digitalfoundry-tech-interview-metro-2033?page=2.
41. ↑ "History - Electric Sheep Games". http://www.electricsheepgames.com/games3. Retrieved 14 April 2011.
42. ↑ Shishkovtsov, Oles (2005-03-07). "GPU Gems 2: Chapter 9. Deferred Shading in S.T.A.L.K.E.R". Nvidia. http://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter09.html. Retrieved 2011-02-02.
43. ↑ "Deferred shading in Tabula Rasa". NVIDIA. http://http.developer.nvidia.com/GPUGems3/gpugems3_ch19.html. Retrieved 2008-02-14.
44. ↑ "Steam Users' Forums - View Single Post - Taking the Physx load off the CPU...". steampowered.com. http://forums.steampowered.com/forums/showpost.php?p=16668774&postcount=5.
45. ↑ "Steam Users' Forums - View Single Post - Trine 2 rendering information - anti-aliasing, overheating, stereo, input lag, etc". steampowered.com. http://forums.steampowered.com/forums/showpost.php?p=27599827&postcount=18.
46. ↑ "CryENGINE 3 Specifications". Crytek GmbH. Archived from the original on March 27, 2009. https://web.archive.org/web/20090327231452/http://www.crytek.com/technology/cryengine-3/specifications/. Retrieved 2009-03-27.
47. ↑ "Lighting you up in Battlefield 3". DICE. March 3, 2011. https://media.contentapi.ea.com/content/dam/eacom/frostbite/files/gdc11-lightingyouupinbattlefield3.pdf. Retrieved September 15, 2011.
48. ↑ "GameStart – Feature List". Archived from the original on 2011-12-02. https://web.archive.org/web/20111202181806/http://gamestart3d.com/feature_list.
49. ↑ "Infinity Development Journal – Deferred Lighting". I-Novae Studios. 2009-04-03. http://www.infinity-universe.com/Infinity/index.php?option=com_content&task=view&id=105&Itemid=26. Retrieved 2011-01-26.
50. ↑ "BUILD: Deferred rendering". 2009-02-26. http://www.develop-online.net/tools-and-tech/build-deferred-rendering/0116368. Retrieved 2015-04-08.
51. ↑ "Torque 3D Development - Advanced Lighting (deferred lighting hybrid)". 2009-03-03. http://www.garagegames.com/community/blog/view/16539/. Retrieved 2015-07-02.
52. ↑ Vosburgh, Ethan (2010-09-09). "Unity 3 Feature Preview – Deferred Rendering". Unity Technologies. http://blogs.unity3d.com/2010/09/09/unity-3-feature-preview-deferred-rendering/. Retrieved 2011-01-26.
53. ↑ "Unreal Engine 4 - Rendering Overview". Epic Games. https://docs.unrealengine.com/latest/INT/Engine/Rendering/Overview/index.html. Retrieved June 6, 2015.
54. ↑ "Vision Engine 8.2 Brings 3D Technologies Cross-Platform". 2011-10-10. Archived from the original on 2012-11-16. https://web.archive.org/web/20121116234611/http://havok.com/news-and-press/releases/vision-engine-82-brings-3d-technologies-cross-platform. Retrieved 2015-04-08.
55. ↑ "The Graphics Technology of Fallout 4". Bethesda Softworks. November 4, 2015. https://bethesda.net/en/article/2Y37xeRPeUW0EgkgaKW8oA/the-graphics-technology-of-fallout-4. Retrieved 2020-04-24.
56. ↑ "raylib [shaders example - deferred rendering"]. Raylib community, Justin Andreas Lacoste. 2023-10-31. https://github.com/raysan5/raylib/blob/master/examples/shaders/shaders_deferred_render.c. Retrieved 2024-01-01.
57. ↑ Saito, Takafumi; Tokiichiro Takahashi (1990). "Comprehensible rendering of 3-D shapes". ACM SIGGRAPH Computer Graphics 24 (4): 197–206. doi:10.1145/97880.97901.
58. ↑ Geldreich, Rich. "GDC 2004 Presentation on Deferred Lighting and Shading". https://sites.google.com/site/richgel99/the-early-history-of-deferred-shading-and-lighting.
59. ↑ "Deferred Shading". NVIDIA. http://download.nvidia.com/developer/presentations/2004/6800_Leagues/6800_Leagues_Deferred_Shading.pdf. Retrieved 2007-03-28.
60. ↑ Klint, Josh. "Deferred Rendering in Leadwerks Engine". Leadwerks. Archived from the original on 2008-12-09. https://web.archive.org/web/20081209174351/http://www.leadwerks.com/files/Deferred_Rendering_in_Leadwerks_Engine.pdf.

* v
* t
* e

Computer graphics

Vector graphics|

* Diffusion curve
* Pixel

2D graphics|

* 2.5D

3D graphics|

* Aliasing
* Graphical projection

Concepts|

* Affine transformation
* Planar projection
* Rotation
* Scaling
* Shear matrix
* Translation

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Deferred shading. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Deferred_shading&oldid=4153037"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template