Deferred renderer: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(Fix typos and improve wording)
Line 1: Line 1:
{{LanguageBar|title=Deferred lighting and Deferred shading}}
{{LanguageBar|title=Deferred lighting and Deferred shading}}
__NOTOC__
__NOTOC__
'''Deferred lighting''' is an alternate lighting technique and modification of '''[[WP:Deferred shading|deferred shading]]''', a screen-space shading technique that allows many lights to be rendered on the scene without significant performance hit.
'''Deferred lighting''' is an alternate lighting technique and modification of '''[[WP:Deferred shading|deferred shading]]''', a screen-space shading technique that allows many lights to be rendered on the scene without a significant performance hit.


It is much different from the default (usually static) [[Radiosity]] lighting that comes with {{Src|4}}. It uses many different lighting passes to generate higher quality lighting, with real time shadows.
It is much different from the default (usually static) [[radiosity]] lighting that comes with {{Src|4}}. It uses many different lighting passes to generate higher quality lighting, with real-time shadows.


{{Src2|4}} games generally use forward rendering like {{hlalyx|4}}, but games like {{d2|4}} and {{deadlock|4}} use deferred rendering.
{{Src2|4}} games generally use forward rendering, like {{hlalyx|4}}, but games like {{d2|4}} and {{deadlock|4}} use deferred rendering.
==Differences from vanilla radiosity==
==Differences from vanilla radiosity==
When compiling a map in any of {{Valve|4|addtext='s}} games, each map is run through [[VRAD]] (which can take a long time depending on hardware and [[Lighting_optimization|optimizations]]), which takes data from all the light sources and compile them into a '''lightmap''' texture. While this does provide high-quality and variable lighting, it is completely static, save for the limited ability to toggle on some lights in a scene. The difference between [[radiosity]] and deferred lighting is that deferred lighting computes all its lights in real time, with low performance cost ([[cheap]]). The game takes data from the normals of the object, its geometry, its albedo, and its specular lighting to create real time accurate lighting.
When compiling a map in any of {{Valve|4|addtext='s}} games, each map is run through [[VRAD]] (which can take a long time depending on hardware and [[Lighting_optimization|optimizations]]), which takes data from all the light sources and compiles them into a '''lightmap''' texture. While this does provide high-quality and variable lighting, it is completely static, save for the limited ability to toggle on some lights in a scene. The difference between [[radiosity]] and deferred lighting is that deferred lighting computes all its lights in real-time, with a low performance cost ([[cheap]]). The game takes data from the normals of the object, its geometry, its albedo, and its specular lighting to create real-time accurate lighting.


==Differences with dynamic lights on forward rendering==
==Dynamic lights in forward rendering==
When using dynamic light entities like {{code|[[env_projectedtexture]]}} (also used on [[player]]'s flashlight since {{src07}}), on forward renderer, it can significantly reduce performance if there are too many of them. Other dynamic lights such as {{code|light_dynamic}}, also reduces performance if the lightmap has small luxel scale and/or the light having [[Lightstyle|custom appearance]] (lightstyles). Additionally, {{code|env_projectedtexture}} is also limited by the {{src|1}} engine itself (by default), meaning that it only works properly with one {{code|env_projectedtexture}} entity, without engine modifications. Deferred lighting (and deferred shading) does not have these issues or limitations and almost infinite numbers of dynamic lights can be active, with less performance loss than forward renderer.
Performance can be significantly reduced if there are too many dynamic light entities like {{code|[[env_projectedtexture]]}} (also used on [[player]]'s flashlight since {{src07}}) in forward rendering. Other dynamic lights such as {{code|light_dynamic}} also reduce performance if the lightmap has a small luxel scale and/or the light has [[Lightstyle|custom appearance]] (lightstyles). Additionally, {{code|env_projectedtexture}} is also limited by the {{src|1}} engine itself (by default), meaning that it only works properly with one {{code|env_projectedtexture}} entity without engine modifications. Deferred lighting (and deferred shading) does not have these issues or limitations and almost an infinite number of dynamic lights can be active with faster performance than with forward rendering.


===Features===
==Features==
*Quite cheap realtime lighting and shadows
*Quite cheap real-time lighting and shadows.
*Almost infinite number of dynamic lights that can be active (stock [[Source]] only allows for one {{ent|env_projectedtexture}} at a time)
*Almost an infinite number of dynamic lights that can be active (stock [[Source]] only allows for one {{ent|env_projectedtexture}} at a time).
*High-fidelity [[Godrays]]
*High-fidelity [[godrays]].
*[[Volumetric lighting]]
*[[Volumetric lighting]].
*Light cookies (premade shadow maps)
*Light cookies (premade shadow maps).


===Drawbacks===
==Drawbacks==
*Traditional antialiasing like [[MSAA]] might not work with it like in {{bms|2}} (which was removed and replaced with FXAA because MSAA combined with deferred lighting caused certain models to have glowing outline around it),{{Cite|1}} but it depends how it was implemented into the game. As with {{asd|1}}, and {{lw|1}} is still supported, through it's recommended that you should use post-processing anti-aliasing method instead as they work best with deferred lighting, and has less performance hit. MSAA are also more demanding with deferred lighting/shading compared to forward rendering.
*Traditional anti-aliasing methods like [[MSAA]] might not work with deferred lighting, like in {{bms|2}} (which replaced it with FXAA because MSAA caused certain models to have a glowing outline),{{Cite|1}} but it depends how it's implemented in the game, as {{asd|1}}, and {{lw|1}} still support it, though it's recommended that you use post-processing anti-aliasing methods instead as they work best with deferred lighting, and have a smaller performance hit. MSAA is also more demanding with deferred lighting/shading compared to forward rendering.
*All lightmaps are disabled and only deferred lighting lights the world. {{only|{{asd}}}}
*All lightmaps are disabled and only deferred lighting lights the world. {{only|{{asd}}}}
*Can be more taxing on older systems.
*Can be more taxing on older systems.
Line 30: Line 30:
==Availability==
==Availability==
=== Source ===
=== Source ===
Very few {{src|1|nt=1}} games utilize this lighting technique, as it is very complicated to implement, the games that do use this are listed here:
Few {{src|1|nt=1}} games utilize this lighting technique, as it's complicated to implement, the games that do use this are:
*{{asd|4}}  
*{{asd|4}}  
*{{bms|4}}
*{{bms|4}}
*{{lw|4}}
*{{lw|4}}
*{{p2d|4}}
*{{p2d|4}}
*{{Tfbranch|4}} (including {{apex|4}}) - using Deferred shading
*{{Tfbranch|4}} (including {{apex|4}}) — using deferred shading
*{{hammer|4}} (Lighting Preview in Stock HL2 and {{strata|4}})
*{{hammer|4}} (Lighting Preview in stock HL2 and {{strata|4}})
=== Source 2 ===
=== Source 2 ===
* {{Dota2|4}}
* {{Dota2|4}}

Revision as of 13:32, 22 February 2025

English (en)中文 (zh)Translate (Translate)

Deferred lighting is an alternate lighting technique and modification of deferred shading, a screen-space shading technique that allows many lights to be rendered on the scene without a significant performance hit.

It is much different from the default (usually static) radiosity lighting that comes with Source Source. It uses many different lighting passes to generate higher quality lighting, with real-time shadows.

Source 2 Source 2 games generally use forward rendering, like Half-Life: Alyx Half-Life: Alyx, but games like Dota 2 Dota 2 and Deadlock Deadlock use deferred rendering.

Differences from vanilla radiosity

When compiling a map in any of Valve Valve's games, each map is run through VRAD (which can take a long time depending on hardware and optimizations), which takes data from all the light sources and compiles them into a lightmap texture. While this does provide high-quality and variable lighting, it is completely static, save for the limited ability to toggle on some lights in a scene. The difference between radiosity and deferred lighting is that deferred lighting computes all its lights in real-time, with a low performance cost (cheap). The game takes data from the normals of the object, its geometry, its albedo, and its specular lighting to create real-time accurate lighting.

Dynamic lights in forward rendering

Performance can be significantly reduced if there are too many dynamic light entities like env_projectedtexture (also used on player's flashlight since Source 2007) in forward rendering. Other dynamic lights such as light_dynamic also reduce performance if the lightmap has a small luxel scale and/or the light has custom appearance (lightstyles). Additionally, env_projectedtexture is also limited by the Source engine itself (by default), meaning that it only works properly with one env_projectedtexture entity without engine modifications. Deferred lighting (and deferred shading) does not have these issues or limitations and almost an infinite number of dynamic lights can be active with faster performance than with forward rendering.

Features

Drawbacks

  • Traditional anti-aliasing methods like MSAA might not work with deferred lighting, like in Black Mesa Black Mesa (which replaced it with FXAA because MSAA caused certain models to have a glowing outline),[1] but it depends how it's implemented in the game, as Alien Swarm Deferred, and Lambda Wars still support it, though it's recommended that you use post-processing anti-aliasing methods instead as they work best with deferred lighting, and have a smaller performance hit. MSAA is also more demanding with deferred lighting/shading compared to forward rendering.
  • All lightmaps are disabled and only deferred lighting lights the world. (only in Alien Swarm Deferred)
  • Can be more taxing on older systems.
  • DX9 SM3 or later only, older DirectX compatibility versions are not supported.

Media

Deferred phong ref.png

Availability

Source

Few Source Engine games utilize this lighting technique, as it's complicated to implement, the games that do use this are:

Source 2

Tutorials

See also

External links

References

References
1. Xen Technical Beta and Screenshot by [TC]Ciaиєz ITA:

Known Issues - Haloing Around Props/Object
MSAA is causing outlines around certain objects. MSSA is a performance killer and we hope to have a better solution for anti-aliasing with the Xen release. To remove the haloing/outline, simply turn off MSAA.. Retrieved on May 10, 2024.