Deferred shading
In the field of 3D computer graphics, deferred shading is a screen-space shading technique. It is called deferred because no shading is actually performed in the first pass of the vertex and pixel shaders: instead shading is "deferred" until a second pass.
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 loaded into the geometry buffer (G-buffer) as a series of textures. 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[2] can be made part of the deferred shading pipeline to give directionality to shadows and interreflections.
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.[3] There are some other advantages claimed for the approach. These advantages may 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.[4] 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 eats up a large amount of the memory bandwidth.[5]
One more rather important 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,[6] however recently more advanced post-process edge-smoothing techniques have been developed, such as MLAA[7] (used in Killzone 3 and Dragon Age 2, among others), FXAA[8] (used in Crysis 2, FEAR 3, Duke Nukem Forever), SRAA,[9] DLAA[10] (used in 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 Halo Reach) can also help give edges a smoother appearance.[11] DirectX 10 introduced features allowing shaders to access individual samples in multisampled 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
Deferred lighting (also known as Light Pre-Pass) is a modification of the Deferred Shading.[12] This technique uses three passes, instead of two in deferred shading. On first pass over the scene geometry, only the attributes necessary to compute per-pixel lighting (irradiance) are written to the G-Buffer. The screen-space, “deferred” pass then outputs only diffuse and specular lighting data, so a second pass must be made over the scene to read back the lighting data and output the final 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.
Due to reduction of the size of the G-buffer this technique can partially overcome one serious disadvantage of the deferred shading - multiple materials. Another problem that can be solved is MSAA. Deferred lighting can be used with MSAA on DirectX 9 hardware.
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[13]
- Bioshock Infinite[14]
- Blur
- Brink
- Crackdown and Crackdown 2[15]
- Crysis 2[16]
- Dead Space,[17] Dead Space 2[18] and Dead Space 3[19]
- Deus Ex: Human Revolution [20]
- Dragon's Dogma [21]
- Guild Wars 2 [22]
- Halo: Reach [23]
- inFamous and inFamous 2
- LittleBigPlanet
- Metal Gear Solid V: Ground Zeroes
- Metal Gear Solid V: The Phantom Pain[24]
- Shift 2 UNLEASHED [25]
- Red Dead Redemption
- Resistance series[26]
- Rochard
- StarCraft II [27]
- Uncharted and Uncharted 2[28]
- Vanquish [29]
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 consoles, where graphic memory size and bandwidth are limited and often a bottleneck.
- Amnesia: The Dark Descent[30]
- Battlefield 3[31]
- Dota 2[32]
- Dungeons
- Grand Theft Auto IV
- Killzone 2 and Killzone 3[33]
- Mafia 2
- Miner Wars 2081[34]
- Metro 2033[35]
- Rift
- Shrek[36]
- Splinter Cell: Conviction
- Stalker: Shadow of Chernobyl, Clear Sky and Call of Pripyat[37]
- Tabula Rasa[38]
- Trine [39]
- Trine 2 [40]
- Viva Pinata
Deferred techniques in game engines
- Torque 3D[41]
- CryEngine 3[42]
- I-Novae[43]
- Unity[44]
- Frostbite 2[45]
- Unreal Engine 3[46]
- Unreal Engine 4[47]
- Chrome Engine
- MT Framework
- GameStart[48]
- Source (game engine)[49]
- Fox Engine[24]
- Leadwerks Engine[50]
- Rockstar Advanced Game Engine[51]
- Havok Vision Engine[52]
History
The idea of deferred shading was originally introduced by Michael Deering and his colleagues in a paper[53] published in 1988 entitled 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,[54] although they too do not use the word "deferred". The first deferred shaded video game was Shrek, an Xbox launch title shipped in 2001.[55] Around 2004, implementations on commodity graphics hardware started to appear.[56] The technique later gained popularity for applications such as video games, finally becoming mainstream around 2008 to 2010.[50]
References
- ↑ http://http.download.nvidia.com/developer/presentations/2004/6800_Leagues/6800_Leagues_Deferred_Shading.pdf
- ↑ "Deferred Screen Space Directional Occlusion". kayru.org.
- ↑ http://homepage.lnu.se/staff/tblma/Deferred%20Rendering%20in%20XNA%204.pdf
- ↑ "NVIDIA SDK 9.51 - Featured Code Samples". NVIDIA. 2007-01-17. Retrieved 2007-03-28.
- ↑ Wolfgang Engel. "Light Pre-Pass Renderer". Diary of a Graphics Programmer.
- ↑ "Deferred shading tutorial" (PDF). Pontifical Catholic University of Rio de Janeiro. Archived from the original (PDF) on March 6, 2009. Retrieved 2008-02-14.
- ↑ http://igm.univ-mlv.fr/~biri/mlaa-gpu/TMLAA.pdf
- ↑ http://www.ngohq.com/images/articles/fxaa/FXAA_WhitePaper.pdf
- ↑ "Subpixel Reconstruction Antialiasing". nvidia.com.
- ↑ Dmitry Andreev. "AND's - dlaagdc2011". intercon.ru.
- ↑ Dmitry Andreev. "Anti-Aliasing From a Different Perspective (GDC 2011 Extended Slides)". intercon.ru.
- ↑ "Real-Time Rendering · Deferred lighting approaches". realtimerendering.com.
- ↑ "Assassin's Creed III: The Redesigned Anvil Engine". www.GameInformer.com.
- ↑ "Bioshock Infinite development is PS3 focused and uses Uncharted 2 tech". blorge.com.
- ↑ "Tech Interview: Crackdown 2". Eurogamer.net. 26 June 2010.
- ↑ guest11b095. "A Bit More Deferred Cry Engine3". slideshare.net.
- ↑ "Dead Space by Electronic Arts". NVIDIA. Retrieved 2008-02-14.
- ↑ "Face-Off: Dead Space 2". Retrieved 2010-02-01.
- ↑ "Face-Off: Dead Space 3". Retrieved 2013-02-18.
- ↑ "Google Translate". google.com.
- ↑ "GregaMan > Manage Blog". capcom-unity.com.
- ↑ "Normals". Imgur.
- ↑ "Tech Interview: Halo: Reach". Eurogamer.net. 11 December 2010.
- 1 2 "Tech Analysis: Metal Gear Solid 5's FOX Engine". Eurogamer.net. 5 April 2013.
- ↑ "The Making of Shift 2 Unleashed Article • Page 2 • Eurogamer.net". Eurogamer.net. 14 May 2011.
- ↑ http://cmpmedia.vo.llnwd.net/o1/vault/gdc09/slides/gdc09_insomniac_prelighting.pdf
- ↑ "StarCraft II Effects & techniques" (PDF). AMD. Retrieved 2012-07-09.
- ↑ "CGSociety Maintenance". cgsociety.org.
- ↑ "Deferred Rendering « PlatinumGames Inc.". platinumgames.com.
- ↑ Silard Šimon. "Frictional Games interview". playsomnia.com.
- ↑ DICE. "SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3". slideshare.net.
- ↑ "Valve Developer Wiki - Dota 2". Retrieved 10 April 2012.
- ↑ http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf
- ↑ Miner Wars 2081
- ↑ "Tech Interview: Metro 2033 Interview • Page 2 • Eurogamer.net". Eurogamer.net. 25 February 2010.
- ↑ "History - Electric Sheep Games". Retrieved 14 April 2011.
- ↑ Shishkovtsov, Oles (2005-03-07). "GPU Gems 2: Chapter 9. Deferred Shading in S.T.A.L.K.E.R". Nvidia. Retrieved 2011-02-02.
- ↑ "Deferred shading in Tabula Rasa". NVIDIA. Retrieved 2008-02-14.
- ↑ "Steam Users' Forums - View Single Post - Taking the Physx load off the CPU...". steampowered.com.
- ↑ "Steam Users' Forums - View Single Post - Trine 2 rendering information - anti-aliasing, overheating, stereo, input lag, etc". steampowered.com.
- ↑ "Torque 3D Development - Advanced Lighting (deferred lighting hybrid)". 2009-03-03. Retrieved 2015-07-02.
- ↑ "CryENGINE 3 Specifications". Crytek GmbH. Archived from the original on March 27, 2009. Retrieved 2009-03-27.
- ↑ "Infinity Development Journal – Deferred Lighting". I-Novae Studios. 2009-04-03. Retrieved 2011-01-26.
- ↑ Vosburgh, Ethan (2010-09-09). "Unity 3 Feature Preview – Deferred Rendering". Unity Technologies. Retrieved 2011-01-26.
- ↑ "Lighting you up in Battlefield 3". DICE. March 3, 2011. Retrieved September 15, 2011.
- ↑ "Unreal Engine 3 Showcase - Samaritan". Epic Games. 2011-03-10. Retrieved 2011-07-07.
- ↑ "Unreal Engine 4 - Rendering Overview". Epic Games. Retrieved June 6, 2015.
- ↑ "GameStart – Feature List".
- ↑ "Deferred lighting - Alien Swarm SDK". 2012-05-29. Retrieved 2012-05-29.
- 1 2 Klint, Josh. "Deferred Rendering in Leadwerks Engine" (PDF). Leadwerks.
- ↑ "BUILD: Deferred rendering". 2009-02-26. Retrieved 2015-04-08.
- ↑ "Vision Engine 8.2 Brings 3D Technologies Cross-Platform". 2011-10-10. Retrieved 2015-04-08.
- ↑ Deering, Michael; Stephanie Winner; Bic Schediwy; Chris Duffy; Neil Hunt. "The triangle processor and normal vector shader: a VLSI system for high performance graphics". ACM SIGGRAPH Computer Graphics (ACM Press) 22 (4): 21–30. doi:10.1145/378456.378468.
- ↑ Saito, Takafumi; Tokiichiro Takahashi (1990). "Comprehensible rendering of 3-D shapes". ACM SIGGRAPH Computer Graphics (ACM Press) 24 (4): 197–206. doi:10.1145/97880.97901.
- ↑ Geldreich, Rich. "GDC 2004 Presentation on Deferred Lighting and Shading".
- ↑ "Deferred Shading" (PDF). NVIDIA. Retrieved 2007-03-28.