This article'slead sectionmay be too short to adequatelysummarize the key points. Please consider expanding the lead toprovide an accessible overview of all important aspects of the article.(July 2013) |




In the field of3D computer graphics,deferred shading is ascreen-spaceshading technique that is performed on a secondrendering pass, after the vertex and pixelshaders are rendered.[2] It was first suggested byMichael 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, apixel shader computes the direct and indirect lighting at each pixel using the information of thetexture buffers inscreen space.
Screen space directional occlusion[4] can be made part of the deferred shading pipeline to give directionality to shadows and interreflections.
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.
One key disadvantage of deferred rendering is the inability to handletransparency within the algorithm, although this problem is a generic one inZ-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 achieveorder-independent transparency in deferred rendering, but at the cost of additional batches and g-buffer size. Modern hardware, supportingDirectX 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, hardwareanti-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 usingedge 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 asMLAA[9][10] (used inKillzone 3 andDragon Age II, among others),FXAA[11] (used inCrysis 2,FEAR 3,Duke Nukem Forever),SRAA,[12]DLAA[13] (used inStar Wars: The Force Unleashed II), and post MSAA (used inCrysis 2 as default anti-aliasing solution). Although it is not an edge-smoothing technique,temporal anti-aliasing (used inHalo: Reach andUnreal 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 (anddepth 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.
This section'sfactual accuracy isdisputed. Relevant discussion may be found on thetalk page. Please help to ensure that disputed statements arereliably sourced.(August 2016) (Learn how and when to remove this 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.
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 isMSAA. Deferred lighting can be used with MSAA on DirectX 9 hardware.[citation needed]
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:
In comparison to deferred lighting, this technique is not very popular[citation needed] due to high memory size and bandwidth requirements, especially on seventh generation consoles where graphic memory size and bandwidth are limited and often bottlenecks.
The idea of deferred shading was originally introduced byMichael Deering and his colleagues in a paper[3] published in 1988 titledThe 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 wasShrek, anXbox 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 asvideo games, finally becoming mainstream around 2008 to 2010.[60]
{{cite web}}: CS1 maint: archived copy as title (link){{cite web}}: CS1 maint: numeric names: authors list (link){{cite web}}: CS1 maint: archived copy as title (link){{cite web}}: CS1 maint: archived copy as title (link)