From Surf Wiki (app.surf) — the open knowledge base
Deferred shading
Screen-space shading technique
Screen-space shading technique
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. It was first suggested by Michael Deering in 1988.
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 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. 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. 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.
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, however recently more advanced post-process edge-smoothing techniques have been developed, such as MLAA{{cite web
Deferred lighting
Deferred lighting (also known as Light Pre-Pass) is a modification of the Deferred Shading. 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.
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
- BioShock Infinite
- Black Mesa
- Blur
- Brink
- Crackdown and Crackdown 2
- Crysis 2
- Dead Space,{{cite web
- Deus Ex: Human Revolution
- Dragon's Dogma
- Guild Wars 2
- Halo: Reach
- inFamous and inFamous 2
- LittleBigPlanet
- Metal Gear Solid V: Ground Zeroes
- Metal Gear Solid V: The Phantom Pain
- Minecraft
- Red Dead Redemption
- Resistance series
- Rochard
- Shift 2: Unleashed
- StarCraft II {{cite web
- Uncharted and Uncharted 2
- Vanquish
- Ghost of Tsushima
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.
- Amnesia: The Dark Descent
- Battlefield 3
- Dota 2
- Dungeons
- Digital Combat Simulator (DCS) World 2.5
- Grand Theft Auto IV
- Killzone 2 and Killzone 3
- Mafia II
- Miner Wars 2081
- Metro 2033
- Rift
- Shrek
- Splinter Cell: Conviction
- The S.T.A.L.K.E.R. game series: Shadow of Chernobyl, Clear Sky and Call of Pripyat{{cite web
- Tabula Rasa{{cite web | archive-url = https://web.archive.org/web/20090203081102/http://http.developer.nvidia.com/GPUGems3/gpugems3_ch19.html | archive-date = 2009-02-03 | url-status = dead
- Trine
- Trine 2
- Viva Pinata
Game engines featuring deferred shading or rendering techniques
- AnvilNext
- Chrome Engine
- CryEngine 3
- Fox Engine
- Frostbite 2{{cite web |archive-url=https://web.archive.org/web/20110825085117/http://publications.dice.se/attachments/GDC11_LightingYouUpInBattlefield3.pptx |url-status=dead |archive-date=August 25, 2011
- GameStart{{cite web |url-status = dead
- Haemimont Games Engine (HGE)
- I-Novae{{cite web | archive-url = https://archive.today/20130126165723/http://www.infinity-universe.com/Infinity/index.php?option=com_content&task=view&id=105&Itemid=26 | url-status = dead | archive-date = 2013-01-26
- Leadwerks
- MT Framework
- Rockstar Advanced Game Engine{{cite web
- Torque 3D{{cite web
- Unity{{cite web
- Unreal Engine 4{{cite web
- Vision{{cite web |url-status = dead
- Creation Engine as of Fallout 4 and Skyrim SE{{cite web
- Fusion Engine (early Illusion Engine) as of Mafia III and Mafia: Definitive Edition
- Raylib{{cite web
- X-Ray Engine
History
The idea of deferred shading was originally introduced by Michael Deering and his colleagues in a paper{{cite journal |url-status = dead
References
References
- (2004). "6800 Leagues Under the Sea: Deferred Shading".
- (October 28, 2013). "Forward Rendering vs. Deferred Rendering".
- O'Donnell, Yuriy. (2011-07-18). "Deferred Screen Space Directional Occlusion". kayru.org.
- Kayi, Celal Cansin. "Deferred Rendering in XNA 4".
- (2007-01-17). "SDK 9.51 – Featured Code Samples".
- Engel. (2008-03-16). "Light Pre-Pass Renderer". Diary of a Graphics Programmer.
- "Deferred shading tutorial". Pontifical Catholic University of Rio de Janeiro.
- "Morphological antialiasing and topological reconstruction".
- "Archived copy".
- (2011-02-01). "Subpixel Reconstruction Antialiasing". [[Nvidia]].
- Andreev. (2011). "Anti-Aliasing from a Different Perspective". and.intercon.ru.
- Andreev. (2011-03-04). "Anti-Aliasing from a Different Perspective (GDC 2011 Extended Slides)". and.intercon.ru.
- (June 2, 2009). "Real-Time Rendering · Deferred lighting approaches". realtimerendering.com.
- "Assassin's Creed III: The Redesigned Anvil Engine".
- "BioShock Infinite development is PS3 focused and uses Uncharted 2 tech". blorge.com.
- Chetan Jags. (18 July 2023). "BlackMesa XenEngine: Part 4 – Lighting & Shadows".
- (26 June 2010). "Tech Interview: Crackdown 2". Eurogamer.net.
- guest11b095. (May 14, 2009). "A Bit More Deferred Cry Engine3". slideshare.net.
- "Google Translate". google.com.
- "GregaMan, Manage Blog". capcom-unity.com.
- "Normals". Imgur.
- (11 December 2010). "Tech Interview: Halo: Reach". Eurogamer.net.
- (5 April 2013). "Tech Analysis: Metal Gear Solid 5's FOX Engine". Eurogamer.net.
- "Archived copy".
- (14 May 2011). "The Making of Shift 2 Unleashed Article • Page 2 • Eurogamer.net". Eurogamer.net.
- "CGSociety Maintenance". cgsociety.org.
- "Deferred Rendering « PlatinumGames Inc.". platinumgames.com.
- "Ghost of Tsushima Analysis: A PS4 Graphics Powerhouse". gamingbolt.com.
- Silard Šimon. "Frictional Games interview". playsomnia.com.
- DICE. (March 8, 2011). "SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3". slideshare.net.
- "Valve Developer Wiki - Dota 2".
- "Archived copy".
- [[Miner Wars 2081]]
- (25 February 2010). "Tech Interview: Metro 2033 Interview • Page 2 • Eurogamer.net". Eurogamer.net.
- "History - Electric Sheep Games".
- "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.
- "CryENGINE 3 Specifications". Crytek GmbH.
- Geldreich, Rich. "GDC 2004 Presentation on Deferred Lighting and Shading".
This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.
Ask Mako anything about Deferred shading — get instant answers, deeper analysis, and related topics.
Research with MakoFree with your Surf account
Create a free account to save articles, ask Mako questions, and organize your research.
Sign up freeThis content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.
Report