Advanced HDR
Advanced HDR
This is a tutorial that will take some time to create but will give a better insight of the effects, modes, and different aspects of HDR through the Source Engine. Also this page is meant as a simple guide on orchestrating HDR effects and implementing them in to your map.
Check out HDR Lighting Basics for more information.
Current games that support HDR
- Half Life 2 Episode 1
- Day of Defeat:Source
- Counter-Strike:Source
- Lost coast
- Now mods support HDR due to the new engine update
So far these are the only games that support HDR.

What is HDR?
As Showcased in Lost Coast as a simple tech demo, HDR is a new lighting method that allows a monitor to go over its ideal brightness or in other words the games color scale to make lighting appear more realistic. In that sense it's now giving the player "Virtual eyes" as it has been put by Valve in the tech demo. Mainly with the aid of an env_tonemap_controller, lighting can be adjusted so when players step into dark non-lit areas, the area will brighten up to allow the player to see better. When the player steps out of that area, he or she walks in to a overly bright light filled area to give the effect that the player's "Virtual eyes" pupils are adjusting to the exposure and large amount of light.
- Here is an example from Half Life 2 Lost coast:
In the first screenshot you can see the player standing outside a dark hallway. Mainly here is where the env_tonemap_controller comes in! It takes care of the auto exposure, minimum and maximum as well as bloom settings for the over-bright effect that you see in the third screenshot. Right now the tonemap controller has its main autoexposure max set to 1 and its minimum exposure set to .9. Also its Bloom scale is set to 1.
Now when the player walks into the tunnel he triggers a trigger_multiple Brush based entity. Its outputs are as follows:
- SetAutoExposureMax-6
- SetAutoExposureMin-2
- SetAutoBloomScale-1.6
All these settings cause the tonemap controller to change different parameters and cause the suns brightness and mainly the HDR lighting to be more brighter than before, and keeps the settings at that rate for a while till the player leaves the brush based 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 env_tonemap_controller is triggered with the new settings by the output OnStartTouch and then set back to the previous settings with the OnEndTouch output.
In the third Screenshot the player walks out of the tunnel and then sees the large amount of light being casted. At this time the players "virtual eyes" are being adjusted, and then finnaly in the final screenshot return back to normal.
The tonemap controller is mainly commanded by a Trigger Multiple and given its default settings by the logic_auto entity. When the map begins, outputs can be sent to the tonemap controller and at that time the tonemap controller changes the lighting parameters. Also throughout the Lost Coast map there are other many riggers the player walks through that cause the ideal brightness to change and rearrange all the exposure settings around. However if a map does not contain a env_tonemap_controller then realy the HDR effect will be a bit random. Continuesly dimming the screen and brightening it up at random times or even when the player steps into a area thats just a tad brighter than the past one. In other words the HDR settings end up acting funny towards the map and HDR is 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. Of course changing the settings and keeping them the same is okay. Mainly though the only reason you might need to change the settings are to really attain or create a certain effect towards the area the player is in currently. Even if it is just for a few seconds. Depending on the amount of over bright effects in your map or even having HDR seem very low still require parameters, so in turn the best idea is really to tinker around with your map till you get just the right setting thats fits and once again if the settings don't seem to fit in a certain area you can always create trigger_multiple volumes around the areas the player needs to travel into that will change the settings and correct any mistakes, or get the lighting just right. The tonemap controller, however does not add more brightness to the area though, those controls still need to be set to the current light entity. In fact it just gives lighting the HDR effect or really a brighter glow but as mentioned does not add more brightness or lighting towards the area. Each light entity has its own HDR brightness parameter which must be set as the overall HDR brightness.
Here is a little example of the effects of a tone map controller in a different environment:
Valve implements the env_tonemap_controller to better control the ideal bright effect of the sun so it's not to overly bright or in other words 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 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 a screenshot below located in Material lighting.
If you are a bit foggy on the I/O system.
Creating a HDR map
Now as to creating a map with HDR in it isnt too hard yet requires some entity's as well as customization towards the env_tonemap_controller as noted above 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.
-First output is going to send a message to the tonemap_controller about the max auto exposure and here is how it goes. -Second 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.
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 thats 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 thats 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!

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.
Here is a list of all HDR commands:
Prefix | Location |
---|---|
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. |
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. |
Currently that is all the console commands known.

HDR Effects
Seen in not only Valve maps but even mod maps, some of these effects are used to trick the player or really in turn add even more detail toward an area. Heres a few of them:
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 to well. Now a new method to show light beaming in toward an area is using env_sprite like this:
Mainly a env_sprite was used here to multiply the amount of light preceding out of the lamp without having the main Light entity have a high brightness setting.
A new effect used with env_sprite is to simulate strong amounts of light poring from the outside into a closed in area. 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 alot 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. Heres how it looks:
Prop Lighting
A few props now have been able to reflect and even cast light for added effect. Many of them now dont 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 entity's. Meaning no more env_sprites really needed or regular light entitys anymore.