Advanced HDR

1. Games with HDR support

So far these are the only games that support HDR:

* Half-Life 2 Episode 1
* Half-Life 2 Episode 2 -Improved HDR
* Team Fortress 2
* Day of Defeat:Source
* Counter-Strike:Source
* Lost Coast
* Now mods support HDR due to the new engine update

Note: Half-Life 2 does not support HDR therefore if you are creating a map and want to run it in HDR it must run under EP1 or one of the other listed games.

2. What is HDR?

As showcased in Lost Coast - 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.

news post image

In the screenshot above 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:


And its minimum exposure set to


While its bloom scale is set to


news post image

Now when the player walks into the tunnel he triggers a trigger_multiple Brush based 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 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





When the player enters the trigger area the env_tonemap_controller is triggered with the new settings by the output


And then set back to the previous settings
with the



news post image

In the above 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 finally 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 lLogic_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 really the HDR effect will be a bit random. Continuously 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


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 that 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:

* Tonemap On
news post image

* Tonemap Off
news post image

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 a screenshot below located 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.

3. Creating a HDR map

Now as to creating a map with HDR in it isn't too hard yet requires some entity's as well as customization towards the env_tonemap_controller as noted above with the Logic_auto entity.

1. 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.

2. 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.

3. Next step is creating a Logic_auto . Once placed open up its properties and go straight to the "Outputs" tab.

news post image

4. One of the main things needed for the env_tonemap_controller to work is outputs sent towards it then received as inputs by the env_tonemap_controller . Take a look at the picture below 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.

news post image

5. 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 env_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.

Thats it!

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 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!

4. 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:

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.

Note: When building cubemaps in HDR it might take a bit longer due to the HDR lightmaps. Thats completely normal so just be patient!

5. 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.

5.1 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:

news post image

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.

From far away:
news post image
Close Up:
news post image

Another use for Env_sprite is to simulate the effects of strong amounts of light poring from the outside into a closed in area. This tends to work great with dark areas as well.

5.2 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:



Mainly this texture can give off a nice glow with the aid of HDR. Heres how it looks:

news post image

5.3 Prop lighting

A few props now have 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 entity's. Meaning neither env_sprite nor regular light entities are required anymore.

Thats it. For now.


View comments ( 15 )

Back to top