Contents
- HDR and exposure adjustment
- Lost Coast example
- Creating a HDR map
- Running a HDR map
HDR and exposure adjustment
As showcased in Lost Coast — a simple tech demo — High Dynamic Range (HDR) is a lighting feature which allows for a broader than normal contrast range between darkness and brightness. The exposure value changes in real time depending on the player’s position and camera angles. When the player is in a dark area of the map, the sky seen through a window/opening of that area will appear brighter than usual. When the player goes towards a more well-lit area of the map, brightness will return to normal levels again, fading from over brightened to normal at a specified rate. The properties of HDR can be adjusted with the aid of an env_tonemap_controller. Exposure levels can be changed manually via the Input-Output system, so the level designer can touch a bit further on the automatic tonemapping. HDR offers maps a higher visual standard with minimal performance drop. It is also easy to implement and it is supported by all Source Engine games at this point, and HDR was later required since
Left 4 Dead engine branch and later engine branch, so all new maps should come with HDR-baked lighting.
Lost Coast example
Before entering the dark area.
Now that the player is in the dark hall, the outside area appears overly bright due to eye adjustment.
The player’s eyes haven’t adjusted yet.
Now the player’s eyes have adjusted.
The purpose of an env_tonemap_controller entity is to help with changes between overly bright areas, and extremely dark areas. It smooths out the exposure transition, and aims to imitate the real world, when the human eye adjusts to extreme brightness changes over a relatively small amount of time.
SetAutoExposureMax: 6.0
SetAutoExposureMin: 2.0
SetBloomScale: 1.6
All these settings cause the tonemap controller to adjust different exposure parameters in real time, and if AutoExposureMin
, AutoExposureMax
, and BloomScale
‘s values are increased, then the sky and any other light sources appear brighter than before. In this specific example, the tonemap controller keeps the settings like this for a while, until the player leaves the trigger area. The tonemap gets directions on how to modify exposure and bloom via inputs, namely OnStartTouch
and OnEndTouch
.
When the player enters the trigger area the new settings of the env_tonemap_controller are applied by the output OnStartTouch
, and then set back to the previous settings
with the OnEndTouch
output, when the player exits that area.
In the third screenshot the player walks out of the tunnel and then experiences brighter light than there actually is. Consequently, exposure values drop, to return brightness to normal. At this time the player’s «virtual eyes» are adjusting, and then finally in the last screenshot they have adjusted completely.
The tonemap controller is mainly commanded by a trigger_multiple, and assigned its default settings by a logic_auto entity. When the map begins, outputs can be fired to the tonemap controller, and it is then that the tonemap controller changes the lighting parameters. Throughout the Lost Coast map there are many other triggers the player walks through, which cause the exposure levels to change. However, if a map does not contain an env_tonemap_controller
, then the HDR effect will really be a bit random: continuously dimming the screen and brightening it up at random times, or even when the player steps into a area that’s just a tad brighter than the previous one. In other words, the HDR settings will end up acting unrealistic in that case and HDR will be set to its default settings of 0
on all exposure and bloom parameters.
On a main note though, each map requires different settings even if using the same skybox material. A good reason you might need to change the settings is to really attain or create a certain effect towards the area the player is currently in, even if it’s just for a few seconds. If you leave the default settings there is a good chance that some areas in the map will have abnormally sharp or strange exposure changes, so in the end the best idea is to tinker around with your map until you achieve the look that you think is right. And if the auto tonemapping adjustments don’t seem to fit in a certain area you can always create trigger_multiple volumes around that specific area, just like Valve did in Lost Coast. That will change the settings manually and correct any mistakes, helping to get the lighting just right, even in the most difficult of lighting scenarios. It should be noted, however, that the tonemap controller does not add any more «real» brightness to the area — it only increases and decreases exposure on top of the actual lighting information the map has. Brightness still needs to be adjusted at the options of the light entity used to cast light. Also, each light entity has its own HDR brightness parameter which should be set the same as the overall HDR brightness. (in most cases it should be left at the default, and so should the light_environment HDR brightness parameter as well.)
Note: With the Release of the Orange Box Engine, Valve has improved tonemapping capabilities for smaller and less dramatic sources of exposure, apart from the skybox. Those sources inlcude sprites, spotlights, and even self-illuminating materials.
Here is an example of the effects of a tonemap controller on different environments:
With the tonemap controller settings on.
Valve implemented the env_tonemap_controller
entity to better control the ideal brightness of the sun so it’s not overly bright and unrealistic. Also, they gave the sun a layered light effect which uses the existing fog in the map, by changing a few light settings and increasing the exposure a bit more than usual.
Another use of env_tonemap_controller
by Valve is the inside corridors of the Citadel which also use the entity to adjust the sensitivity levels, so the metal wall textures look a bit nicer.
Creating a HDR map
Creating a map with HDR support isn’t too hard, though it still requires a few entities as well as some I/O work regarding the env_tonemap_controller. As noted above, the initial I/O logic on map spawn will be achieved with the logic_auto entity.
- First, place a env_tonemap_controller in the map. The entity needs to be in the map but as location does not effect anything. Some community maps, as well as some of Valve’s maps tend to have the env_tonemap_controller at the start of the level near the player included with other global entities for better organization purposes and clarity.
- Now at this point the best thing to do is give the the env_tonemap_controller a name. It does not really matter what the name is but for the example map shown above it was named
tonemap_controller
- The next step is creating a logic_auto. Once placed open up its properties and go straight to the «Outputs» tab.
- Take a look at the picture to the right with the logic_auto selected in it. These are the settings that were set as outputs, however for your map you might choose different settings.
- With the logic_auto placed in you map, and with the outputs tab open, create a new output.
The first output is going to send a message to the tonemap_controller
about the maximum auto exposure and the second output is going to send a message regarding the minimum auto exposure.
My output named | Target entity | Via this input | Parameter | Delay | Only once |
---|---|---|---|---|---|
OnMapSpawn | tonemap_controller | SetAutoExposureMax | 2 | 0.00 | No |
Note:In the above example, remember to replace the entity names with your own.
Although not the simplest thing, HDR isn’t too hard to work with. However it adds a large amount of time to the compile process. In fact, vrad
must run twice. Once for LDR and a second time for HDR. The first thing in creating an HDR map is of course an HDR-supported sky texture. See this page for a list of skyboxes which support HDR as well as the ideal lighting parameters for them.
Tip:CS:GO, Episode 2 and Black Mesa all have HDR skyboxes, so if you need some good HDR-baked sky textures, you could import the textures from those games into your mod or the custom files directory for the game you’re working with. Alternatively, there are a lot of HDR skybox textures in public online modding websites such as GameBanana.
Once you’ve picked one open the map menu located on the top right of Hammer, and then go to map properties. On the properties panel set the skybox material field to whatever the skybox texture you picked is called. Then click apply.
Note:CS:GO maps automatically compile with HDR. Do not alter the HDR Brightness
properties of your light entities or light_environment, and compile your maps using the HDR Full Compile preset, found in expert settings. For the final compile with HDR you should use Full Compile -both -final (Slow!)
Because HDR is brighter and adds a glow to the world its wise to set the brightness value a bit lower the the regular LDR brightness. In example if LDR brightness is 100
then HDR should be set to 50
. Mainly it really depends though on the lights source and effect that your going for. Mainly though never have both the same. You have to take in to consideration players who don’t have HDR capable video cards. Therefore the brightness must be equivalent to that in-game of LDR. Once you’re done setting up the values click apply on the properties panel and well that’s it. Now go ahead and run your map. Make sure you have HDR checked in the compile window checked. If you’re compiling under the advanced window then simply set the compile type to HDR -final
or HDR -final -fast
. If you’re just testing then fast might be a good idea to run and create a quick build version of lighting in your map. When you complete your map fully then go for the final compile but note, it takes quite a long time depending on the size, number of lights, and complexity of lightmaps used in your map!
Note:Don’t forget to adjust the HDR Brightness
property of your light_environment
entity.
Running a HDR map
Command | Action |
---|---|
mat_autoexposure_min | Minimum exposure settings. |
mat_autoexposure_max | Maximum exposure settings. |
mat_hdr_enable 0/1 | 0 Turns off HDR, 1 turns HDR on.
|
mat_hdr_enabled | (in all games since ) Report if HDR is enabled for debugging |
mat_hdr_level 0/1/2 | Adjusts the overall bright effect of HDR (0 = Off (LDR), 1 = LDR with Bloom, 2 = Enable HDR). This is also used to turn on/off HDR.
|
mat_hdr_manual_tonemap_rate 0.000000 | Sets the tonemap rate. |
mat_hdr_tonemapscale 0.00000 | Sets the tonemap scale |
mat_hdr_tonemapscaleMax 1-16 | Sets the maximum scale |
mat_hdr_overbrightrange | Sets an override parameter on HDR level for added adjustment. |
Seen not only in stock but also custom maps, some of these effects are used to trick the player or add even more detail toward an area.
Env_sprite used to be for just lights. Really its main purpose was to add a small glow effect toward lights. Also, the old method of getting a glow was using env_glow which didn’t work all too well. Now a new method to show light beaming in toward an area is using env_sprite like this:
Here it is used to multiply the amount of light preceding out of the lamp without having the main Light entity have a high brightness setting.
Another use for env_sprite
is to simulate the effects of strong amounts of light pouring from the outside into a closed in area. This tends to work great with dark areas as well.
An env_sprite from far away.
Used as the light pouring in from outside.
Another one of a HDR tech is mainly using textures that support or give off ambient light. This was used quite a lot in Episode 1 within the Citadel and acts as Bright white lighting within the citadel. Mainly the texture is lights/white004_nochop
. Mainly this texture can give off a nice glow with the aid of HDR, as seen in the picture.
A few props have now been able to reflect and even cast light for an added effect. Many of them now don’t even require lights any more to give off an effect that they are on. Now using HDR the light models glow and require less light entities. Meaning neither env_sprite
nor regular light entities are required anymore.
why doesn‘t dota2 have hdr?
Showing — of comments
Lizz
Originally posted by 8-Bit Ears:
auto hdr works fine
displayer suck when HDR is turned on
Put in full screen, not borderless. Auto hdr works great in full screen, looks really good. But it has issues with borderless fullscreen.
Lizz
Originally posted by 8-Bit Ears:
Put in full screen, not borderless. Auto hdr works great in full screen, looks really good. But it has issues with borderless fullscreen.
Dude, are you sure you have an hdr display? for example LG C2
Niger
what is hdr ?
Lizz
Niger
wow, and dota doesn’t have that ?
Originally posted by TheOther:
wow, and dota doesn’t have that ?
Windows 11 has auto hdr for most games including dota 2 but apparantly TC dosnt understand how to use it, because it works great.
Lizz
Originally posted by muramasa 4-5:
My HDR works fine
bro,this game not supproted hdr
Niger
anyway, hdr won’t make you immortal
Small indie company. They’re still working on the getting the important things right, like a decent matchmaking system and automatic smurf detection. Give them time.
Originally posted by Lizz:
Originally posted by muramasa 4-5:
My HDR works fine
bro,this game not supproted hdr
How dumb are you lol why do you completely ignore a basic feature of windows? Auto hdr looks just as good as normal hdr
Lizz
Lizz
Showing — of comments
Comparison between LDR, LDR with Bloom and HDR (mat_hdr_level 0/1/2
respectively).
High Dynamic Range (HDR) rendering simulates brightness above that which a computer monitor is capable of displaying, before downconverting to
Standard Dynamic Range (SDR, internally referred to in and 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 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.
Since
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.
HDR in 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. Both of these are expedient to gameplay of course, especially in multiplayer.
In fact, by default, Source does not even create «proper» HDR images. Instead, it collapses the image down to LDR early, like many other games in the 2000s/early 2010s. The only Source engine game that support native HDR output is on consoles.
- In Portal 2, while you can disable HDR using console command (
mat_hdr_level 0
), all Portal 2 maps does not 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 command.
Todo: How does
improve HDR?