This article's documentation is for anything that uses the Source engine. Click here for more information.
This article's documentation is for Source 2. Click here for more information.

HDR: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(→‎HDR in Source 2: - this comparison looks somewhat broken when viewing pages on low resolution monitors (1366x768) so reduced image size. Also removing border since it will get cutoff by two images on the right side.)
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{LanguageBar|title=HDR rendering}}
{{LanguageBar|title=HDR}}


[[File:HL2_LostCoast_17.jpg|thumb|right|An overexposed image from {{hl2lc|4}}]]
[[File:HL2_LostCoast_17.jpg|thumb|right|An overexposed image from {{hl2lc|4}}]]
Line 5: Line 5:
[[File:Source_HDR_comparison.jpg|thumb|right|Comparison between LDR, LDR with Bloom and [[HDR]] ({{code|mat_hdr_level 0/1/2}} respectively).]]
[[File:Source_HDR_comparison.jpg|thumb|right|Comparison between LDR, LDR with Bloom and [[HDR]] ({{code|mat_hdr_level 0/1/2}} respectively).]]


'''High Dynamic Range''' ('''HDR'''), in {{src|4}} and {{src2|4}} (and most games in 2000s), refers to '''High Dynamic Range rendering''' ('''HDR Rendering''' for short, or '''HDR lighting'''), which simulates brightness above that which a computer monitor is capable of displaying, before downconverting to {{w|Standard dynamic range|Standard Dynamic Range}} (SDR, internally referred to in {{src|1}} and {{src2|1}} as '''LDR''', for '''Low Dynamic Range''') video. This mainly involves "blooming" colors above 100% brightness into neighboring areas and adjusting a virtual camera [[W:aperture|aperture]] to compensate for any over-exposure that results.
'''High Dynamic Range''' ('''HDR''') in {{src|4}} and {{src2|4}} refers to '''High Dynamic Range rendering''' ('''HDR Rendering''' for short, or '''HDR lighting'''), is the process of generating computer graphics scenes using lighting calculations done in high dynamic range (HDR). It simulates and automatically adjust brightness & exposure into neighboring areas, mimicking the way cameras and even eyes handle light exposure, then collapsing the image {{w|Standard dynamic range|Standard Dynamic Range}} (SDR, internally referred to in {{src|1}} and {{src2|1}} as '''LDR''', for '''Low Dynamic Range''') video. This mainly involves "blooming" colors above 100% brightness into neighboring areas and adjusting a virtual camera [[W:aperture|aperture]] to compensate for any over-exposure that results.


Besides the obvious effects of this (see right), HDR gives richer colors and finer gradients: since bright and dark areas are pushed into white and black, correctly exposed areas are drawn with a far wider range of values.
Besides the obvious effects of this (see right), HDR gives richer colors, better contrast and finer gradients: since bright and dark areas are pushed into white and black, correctly exposed areas are drawn with a far wider range of values.
 
{{Confusion|'''HDR rendering''' (which basically renders the scene with better contrast, more saturated color and having auto-exposure & brightness adjustment then collapse the image to '''SDR''') ''is different'' from '''HDR display output''' (which actually outputs the image to HDR-compatible display and renders the image at higher brightness & contrast than SDR monitors). Source engine (aswell as Source 2) never officially support HDR display output. See more on [[#Limitations]] section.}}


== Predecessor to HDR ==
== Predecessor to HDR ==
{{csxbox|3.1}}, a {{gldsrc|1}} game, had a feature called "'''Dynamic iris simulation'''". This adjusts the screen brightness depending on where you look.
The {{gldsrc|1}} game {{csxbox|3.1}} has a feature called "'''Dynamic iris simulation'''". This adjusts the screen brightness depending on where you look.


== HDR in Source ==
== HDR in Source ==
'''HDR rendering''' is first introduced with {{Hl2lc|3.1}}, a tech demo, along with {{dods|3.1}}, released in Sep 2005, and later available with {{src06|2}} and subsequent Source branches. HDR requires DirectX 9 ({{code|dxlevel 90}} or higher) level GPU for {{win|1}} (or OpenGL 1.4 and later for {{mac|1}}/{{linux|1}}), and maps must be compiled with HDR lighting data. It is optional but recommended that the map's skybox textures are HDR-capable.
'''HDR rendering''' was first demonstrated in {{hl2|1}} during it's development (2003), but it was later eventually cut before Half-Life 2 was released.


Even through HDR was introduced in Source 2006, initially in certain games such as {{css|2}}, {{hl2|2}} (both at the time having been upgraded to {{src06|name}}), not all maps were compiled with HDR support until the engine (and Mac) update in 2010, upgrading it to {{src09|2}} along with changes to the maps and skybox textures to support HDR.
Later, '''HDR rendering''' is reintroduced with {{Hl2lc|3.1}}, a tech demo, along with {{dods|3.1}}, released in Sep 2005 (both runs on updated version of {{src04|1}}).


However, as of today (with both CSS and HL2 are running on {{src13|1}}), Valve forgot to compile all the maps with both LDR and HDR support in {{hl2|1}}, leaving some of the maps LDR only, and others HDR only, requiring users to enable HDR, otherwise the HDR-only map will be rendered in fullbright.
{{src06|2}} and subsequent Source branches later ships with HDR support out of the box. HDR requires DirectX 9 ({{code|dxlevel 90}} or higher) level GPU for {{win|1}} (or OpenGL 1.4 and later for {{mac|1}}/{{linux|1}}), and maps must be compiled with HDR lighting data. It is optional but recommended that the map's skybox textures are HDR-capable.


Additionally, {{Src07|3.1}} improves HDR through remade HDR tonemapping in order to better fits outdoor scenes. This may results in brighter or darker image, if tonemapping was not adjusted.
Additionally, {{Src07|3.1}} improves HDR through remade HDR tonemapping in order to better fits outdoor scenes. This may results in brighter or darker image, if tonemapping was not adjusted.
=== Specific games ===
While HDR was introduced in both Source 2004 (since Lost Coast engine update) and Source 2006, initially in certain games such as {{css|2}}, {{hl2|2}} (both at the time having been upgraded to Lost Coast engine and later {{src06|name}}), Counter-Strike: Source only had some maps were compiled with HDR rendering, while Half-Life 2 had none until the engine (and Mac) update in 2010, upgrading it to {{src09|2}} along with changes to the maps and skybox textures to support HDR. Half-Life 2 on console ({{tob|1}} for {{360|1}} and {{ps3|1}}, runs on {{src07|1}}), did have HDR rendering in all maps, however.
After May 2010, up until November 2024 with {{hl2|1}} 20th Anniversary Update, Valve forgot to compile all the maps with both LDR and HDR support in {{hl2|1}}, leaving some of the maps LDR only, and others HDR only, requiring users to enable HDR, otherwise the HDR-only map will be rendered in fullbright. Other games such as {{css|1}} (even when it's currently now running on {{tf2branch|1}}) still have maps compiled with LDR lighting only, and have no effect when HDR is enabled.


=== Limitations ===
=== Limitations ===
{{src|4}} does not have a physically accurate HDR simulation. Its camera has a far wider range than the human eye (let alone real cameras), and it also adjusts to changes in brightness far faster (this can be adjusted through {{mono|[[env_tonemap_controller]]}}'s {{code|SetTonemapRate}} [[keyvalue]] however). Both of these are expedient to gameplay of course, especially in multiplayer.
{{src|4}} does not have a physically accurate HDR simulation. Its camera has a far wider range than the human eye (let alone real cameras), and it also adjusts to changes in brightness far faster (this can be adjusted through {{mono|[[env_tonemap_controller]]}}'s {{code|SetTonemapRate}} [[keyvalue]] however). Both of these are expedient to gameplay of course, especially in multiplayer.


==== HDR display output ====
Source '''does not''' create "''proper''" HDR images, and does not support native HDR output for HDR-capable TV/monitors. Instead, [https://steamcdn-a.akamaihd.net/apps/valve/2006/SIGGRAPH06_Course_HDRInValvesSourceEngine_Slides.pdf it collapses the image down to SDR early]. The average user would be hard-pressed to tell the difference, however, and the benefits include support for all DX9+ GPUs, [[MSAA]] compatibility, and excellent performance.  
Source '''does not''' create "''proper''" HDR images, and does not support native HDR output for HDR-capable TV/monitors. Instead, [https://steamcdn-a.akamaihd.net/apps/valve/2006/SIGGRAPH06_Course_HDRInValvesSourceEngine_Slides.pdf it collapses the image down to SDR early], like many other games in the 2000s/early 2010s due to hardware and software limitations at the time. The only Source engine game that currently support native HDR output is {{Apex|1}} on consoles, and it requires HDR-capable TV/monitors.


The average user would be hard-pressed to tell the difference, however, and the benefits include support for all DX9+ GPUs, [[MSAA]] compatibility, and excellent performance.
{{note|The only Source engine game to currently support native HDR output is {{Apex|1}} on consoles, and it requires an HDR-capable TV/monitor.
 
On systems with Windows 11, you can use '''Auto HDR''', '''RTX HDR''' ({{nvidia|2}} GPUs only) or {{pcgw|Glossary:High_dynamic_range_(HDR)#Enable_HDR_output_in_unsupported_games|other methods here|icon=hide}} as a workaround. Note that Auto HDR only works with Source games running on Direct3D 11. Most Source games (which usually run on Direct3D 9) requires {{pcgw|DgVoodoo_2|dgVoodoo2}} to translate D3D9 to D3D11/D3D12, allowing the use of Auto HDR. Keep in mind that using dgVoodoo2 is not recommended on {{src06|1}} games or earlier, as it will break the [[Source_2006#Known_issues|gray fog/dense fog]] bug fix on NVIDIA GPUs. Alternatively, you can use '''RTX HDR''', which works with Direct3D 9, 11 and 12.
}}


=== LDR deprecation in newer games ===
=== LDR deprecation in newer games ===
Line 40: Line 48:


== HDR in Source 2 ==
== HDR in Source 2 ==
[[File:CS2_HDR_overexposed.jpg|thumb|right|An overexposed image from {{cs2|4}}]]
[[File:CS2_HDR_animated.gif|thumb|right|HDR animated from low to high exposure. (Click to view if GIF does not play automatically).]]
{{todo|How does {{src2}} improve HDR?}}
{{todo|How does {{src2}} improve HDR?}}
{{Cs2|4}} adds a option for switching between Performance and Quality HDR.
{{Cs2|4}} adds a option for switching between Performance and Quality HDR. In most cases both HDR settings looks nearly identical, except the former was less demanding, and will produce noisy film grain effect (which are largely unnoticeable at native resolution).
 
However, if you enable FSR upscaling, Performance HDR will make film grain effect more noticeable (especially when the exposure & brightness is low), while Quality HDR doesn't.
 
<div style="text-align:center;margin:auto;width:780px;background:F9F9F9;padding:.3em;">
<div>[[File:CS2_HDR_-_low_exposure_performance_HDR.jpg|240px|Performance HDR - low exposure.]] [[File:CS2_HDR_-_low_exposure_quality_HDR.jpg|240px|Quality HDR - low exposure.]]</div>
<div>[[File:CS2_HDR_-_high_exposure_performance_HDR.jpg|240px|Performance HDR - high exposure.]] [[File:CS2_HDR_-_high_exposure_quality_HDR.jpg|240px|Quality HDR - high exposure.]]</div>
<div style="font-size:.85em;">Comparison between Performance and Quality HDR with low and high exposure, when FSR is enabled (set to Performance).</br>Top - Low exposure & brightness, Bottom - High exposure & brightness</div>
</div>


== See also ==
== See also ==
Line 53: Line 71:
* {{Wikipedia|Standard-dynamic-range video}}
* {{Wikipedia|Standard-dynamic-range video}}


[[Category:Source]]
{{source topicon}}
{{source 2 topicon}}
[[Category:Lighting]]
[[Category:Lighting]]
[[Category:HDR]]
[[Category:HDR]]

Latest revision as of 08:51, 30 August 2025

English (en)Deutsch (de)Español (es)한국어 (ko)Русский (ru)中文 (zh)Translate (Translate)
An overexposed image from Half-Life 2: Lost Coast Half-Life 2: Lost Coast
Comparison between LDR, LDR with Bloom and HDR (mat_hdr_level 0/1/2 respectively).

High Dynamic Range (HDR) in Source Source and Source 2 Source 2 refers to High Dynamic Range rendering (HDR Rendering for short, or HDR lighting), is the process of generating computer graphics scenes using lighting calculations done in high dynamic range (HDR). It simulates and automatically adjust brightness & exposure into neighboring areas, mimicking the way cameras and even eyes handle light exposure, then collapsing the image Wikipedia icon Standard Dynamic Range (SDR, internally referred to in Source and Source 2 as LDR, for Low Dynamic Range) video. This mainly involves "blooming" colors above 100% brightness into neighboring areas and adjusting a virtual camera aperture to compensate for any over-exposure that results.

Besides the obvious effects of this (see right), HDR gives richer colors, better contrast and finer gradients: since bright and dark areas are pushed into white and black, correctly exposed areas are drawn with a far wider range of values.

Warning.pngRisk of Confusion:HDR rendering (which basically renders the scene with better contrast, more saturated color and having auto-exposure & brightness adjustment then collapse the image to SDR) is different from HDR display output (which actually outputs the image to HDR-compatible display and renders the image at higher brightness & contrast than SDR monitors). Source engine (aswell as Source 2) never officially support HDR display output. See more on #Limitations section.

Predecessor to HDR

The GoldSrc game Counter-Strike (Xbox) has a feature called "Dynamic iris simulation". This adjusts the screen brightness depending on where you look.

HDR in Source

HDR rendering was first demonstrated in Half-Life 2 during it's development (2003), but it was later eventually cut before Half-Life 2 was released.

Later, HDR rendering is reintroduced with Half-Life 2: Lost Coast, a tech demo, along with Day of Defeat: Source, released in Sep 2005 (both runs on updated version of Source 2004).

Source 2006 Source 2006 and subsequent Source branches later ships with HDR support out of the box. HDR requires DirectX 9 (dxlevel 90 or higher) level GPU for Windows (or OpenGL 1.4 and later for macOS/Linux), and maps must be compiled with HDR lighting data. It is optional but recommended that the map's skybox textures are HDR-capable.

Additionally, Source 2007 improves HDR through remade HDR tonemapping in order to better fits outdoor scenes. This may results in brighter or darker image, if tonemapping was not adjusted.

Specific games

While HDR was introduced in both Source 2004 (since Lost Coast engine update) and Source 2006, initially in certain games such as Counter-Strike: Source Counter-Strike: Source, Half-Life 2 Half-Life 2 (both at the time having been upgraded to Lost Coast engine and later Source 2006), Counter-Strike: Source only had some maps were compiled with HDR rendering, while Half-Life 2 had none until the engine (and Mac) update in 2010, upgrading it to Source 2009 Source 2009 along with changes to the maps and skybox textures to support HDR. Half-Life 2 on console (The Orange Box for Xbox 360 and PlayStation 3, runs on Source 2007), did have HDR rendering in all maps, however.

After May 2010, up until November 2024 with Half-Life 2 20th Anniversary Update, Valve forgot to compile all the maps with both LDR and HDR support in Half-Life 2, leaving some of the maps LDR only, and others HDR only, requiring users to enable HDR, otherwise the HDR-only map will be rendered in fullbright. Other games such as Counter-Strike: Source (even when it's currently now running on Team Fortress 2 branch) still have maps compiled with LDR lighting only, and have no effect when HDR is enabled.

Limitations

Source Source does not have a physically accurate HDR simulation. Its camera has a far wider range than the human eye (let alone real cameras), and it also adjusts to changes in brightness far faster (this can be adjusted through env_tonemap_controller's SetTonemapRate keyvalue however). Both of these are expedient to gameplay of course, especially in multiplayer.

Source does not create "proper" HDR images, and does not support native HDR output for HDR-capable TV/monitors. Instead, it collapses the image down to SDR early. The average user would be hard-pressed to tell the difference, however, and the benefits include support for all DX9+ GPUs, MSAA compatibility, and excellent performance.

Note.pngNote:The only Source engine game to currently support native HDR output is Apex Legends on consoles, and it requires an HDR-capable TV/monitor.

On systems with Windows 11, you can use Auto HDR, RTX HDR (Nvidia Nvidia GPUs only) or other methods here as a workaround. Note that Auto HDR only works with Source games running on Direct3D 11. Most Source games (which usually run on Direct3D 9) requires Pcgw icon.png dgVoodoo2 to translate D3D9 to D3D11/D3D12, allowing the use of Auto HDR. Keep in mind that using dgVoodoo2 is not recommended on Source 2006 games or earlier, as it will break the gray fog/dense fog bug fix on NVIDIA GPUs. Alternatively, you can use RTX HDR, which works with Direct3D 9, 11 and 12.

LDR deprecation in newer games

Since the Left 4 Dead engine branch Left 4 Dead engine branch and later games (with some exceptions), HDR rendering is now required and LDR/SDR rendering has been deprecated, with the option to disable HDR removed.

Note.pngNote:Third-party games like Team Fortress 2 Classic Team Fortress 2 Classic also require HDR

Despite LDR being deprecated since Left 4 Dead Left 4 Dead, some games like Portal 2 Portal 2 as well as the original release of Dota 2 Dota 2 allow users to disable HDR through console commands, however:

  • In Portal 2, while you can disable HDR using console commands (mat_hdr_level 0), no Portal 2 maps have LDR lighting compiled by default, which will cause "mat_fullbright" ('full bright' lighting) to be enabled.
  • In the original release of Dota 2, the game only uses LDR lighting, and none of the maps appear to have HDR lighting data. Additionally the game does not have an option to enable HDR aside from using console commands.
  • In Left 4 Dead Left 4 Dead and Left 4 Dead 2 Left 4 Dead 2, HDR can be only disabled via the launch command (mat_hdr_level 0) as the command is hidden ingame, but you can use SourceMod (for Left 4 Dead) or VScript (for Left 4 Dead 2) to disable it while the game is already running.
    • Left 4 Dead sm_cvar mat_hdr_level 0/1/2 command (with SourceMod installed) or
      Left 4 Dead 2 script Convars.SetValue("mat_hdr_level", "0/1/2") (using VScript).

HDR in Source 2

An overexposed image from Counter-Strike 2 Counter-Strike 2
HDR animated from low to high exposure. (Click to view if GIF does not play automatically).
Todo: How does Source 2 improve HDR?

Counter-Strike 2 Counter-Strike 2 adds a option for switching between Performance and Quality HDR. In most cases both HDR settings looks nearly identical, except the former was less demanding, and will produce noisy film grain effect (which are largely unnoticeable at native resolution).

However, if you enable FSR upscaling, Performance HDR will make film grain effect more noticeable (especially when the exposure & brightness is low), while Quality HDR doesn't.

Performance HDR - low exposure. Quality HDR - low exposure.
Performance HDR - high exposure. Quality HDR - high exposure.
Comparison between Performance and Quality HDR with low and high exposure, when FSR is enabled (set to Performance).
Top - Low exposure & brightness, Bottom - High exposure & brightness

See also

External links