Advanced HDR
What is HDR?
As showcased in Lost Coast - a simple tech demo - HDR is a lighting feature which allows for a higher 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 [Inputs and Outputs|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, so all new maps should come with HDR-baked lighting.

Lost Coast example
The job 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.
Now, when the player walks into the tunnel they trigger a trigger_multiple brush entity. Its outputs are as follows:
SetAutoExposureMax: 6.0
SetAutoExposureMin: 2.0
SetAutoBloomScale: 1.6
All these settings cause the tonemap controller to change different parameters and cause the sun's brightness and mainly the HDR lighting to be more bright than before. It keeps the settings like this for a while (until the player leaves the trigger area).
The effects are applied in this way with the use of the OnStartTouch
and OnEndTouch
outputs.
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 sees the large amount of light being cast. At this time the player's "virtual eyes" are adjusting, and then finally in the final screenshot the exposure levels return back to normal.
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 are 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.)

Here is an example of the effects of a tonemap controller on different environments:
Valve implemented the env_tonemap_controller
to better control the ideal bright effect of the sun so it's not overly bright, i.e. unrealistic. Also, they gave the sun an effect with the existing fog in the map, by changing a few settings and giving a bit of a more-than-normal brightness to appear layered by the fog.
One other thing is mainly the inside corridors of the Citadel which also use the env_tonemap_controller to adjust the sensitivity levels seen in the screenshot below in Material lighting.
If you are a bit foggy on the I/O system, the following section covers this process through a step-by-step guide.
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 which, as noted above, will be achieved with the Logic_auto entity.
- First things first. Place a env_tonemap_controller in the map. The entity needs to be in the map but as location does not effect anything. Mainly some mappers as well as some of valves maps tend to have the env_tonemap_controller at the start of the level near the player included with the main 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
- Next step is creating a Logic_auto. Once placed open up its properties and go straight to the "Outputs" tab.
- One of the main things needed for the env_tonemap_controller to work is outputs sent towards it then received as inputs by the
tonemap_controller
. 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 require different settings. - With the Logic_auto placed in you map and now with the outputs tab open create a new output.
The first output is going to send a message to the tonemap_controller
about the max auto exposure and here is how it goes. The second output is going to send a message concerning the minimum auto exposure.
My Output | Target Entity | Target Input | Parameter | Delay | Only Once |
---|---|---|---|---|---|
OnMapSpawn | tonemap_controller | SetAutoExposureMax | 4 | 0.00 | No |

Although not the simplest thing, HDR isn't a very hard technique to work with however it deals a large amount of time to the compile process. In fact, vrad
must run twice. Once for LDR and the second time for HDR. The first thing in creating an HDR map is of course a HDR sky texture. See this page here for a list of sky's in HDR as well as ideal parameters for them.
Once you've picked one out open the map menu located on the top right of Hammer then go to map properties. On the properties panel set the skybox material name to the skybox texture name field. Now click apply.

HDR Brightness
properties of your lights/light_environments and compile your maps using the Full Compile HDR preset in expert settings.Mainly aside from that HDR maps aren't to hard to create. In fact you need to fill in the HDR brightness field on a light entity's properties panel and that's about it. Mainly 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!

HDR Brightness
property of your light_environment
entity.Running a HDR map
Now that the compile process has finished in-game open up your console and type in buildcubemaps
. In order to really get the lighting right you need to build cubemaps twice. Once for LDR and once for HDR. Once building the cubemaps have finished type in mat_hdr_enable 0
in the console to disable HDR and return to LDR. Now simply buildcubemaps
again. You're done! The game will return automatically to HDR so theres no more console commands needed. Through the console however you can change around the exposure levels of the env_tonemap_controller
.
The following console commands are currently available for HDR:
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_level 0/1/2 |
Adjusts the overall bright effect of HDR (0 = Off, 1 = Bloom, 2 = Full). |
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. |
HDR effects
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.
Sprite glow
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.
Texture lighting
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.
Prop lighting
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.
See also
- HDR Lighting Basics - general information on the subject.
- Sky List - a list of HDR-supported skyboxes, with their optimal settings.