Difference between revisions of "Advanced HDR"
(→What is HDR?)
(→Valve games with HDR support)
|Line 11:||Line 11:|
* [[Team Fortress 2]]
* [[Team Fortress 2]]
* [[Left 4 Dead]]
* [[Left 4 Dead]]
* [[Left 4 Dead 2]]
* [[Left 4 Dead 2]]
Revision as of 13:31, 14 May 2011
Advanced HDR setup.
Valve games with HDR support
So far the following titles support HDR:
- Half-Life 2
- Day of Defeat: Source
- Counter-Strike: Source
- Half-Life 2: Episode One
- Half-Life 2: Episode Two
- Half-Life 2: Lost Coast
- Team Fortress 2
- Portal 2
- Left 4 Dead
- Left 4 Dead 2
- Mods based on Source SDK Base and Source SDK Base - Orangebox
What is HDR?
As showcased in Lost Coast - a simple tech demo - HDR is a new lighting method which allows a monitor to go over its ideal brightness. It allows the tweaking of the player's "virtual eyes", changing exposure levels as they go along. With the aid of an env_tonemap_controller, exposure levels can be adjusted, I.E; players stepping into a dark non-lit area after receiving a large exposure from a much brighter area.
Lost Coast example
The Tonemap Controller's job is to help in oscillations between overly bright areas, and extremely dark areas, and the in-between.
Now, when the player walks into the tunnel they trigger a trigger_multiple Brush based entity. Its outputs are as follows:
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, and keeps the settings at that rate for a while (until 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
OnStartTouch, and then set back to the previous settings
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 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 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 many other triggers the player walks through that cause the ideal brightness to change, changing the exposure settings. 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 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, 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 currently in - even if it's just for a few seconds. Depending on the amount of over-bright effects in your map - or even having HDR seem very low - it still requires parameters, so in turn the best idea is really to tinker around with your map until you get just the right setting that fits. And, once again, if it 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'll 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 - those controls still need to be set to the current light entity. In fact it just gives lighting 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 an example of the effects of a tonemap controller on a different environment:
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
- 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
- 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|
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!
HDR Brightnessproperty of your
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
The following console commands are currently available for HDR:
||Minimum exposure settings.|
||Maximum exposure settings.|
||0 Turns off HDR, 1 turns HDR on.|
||Adjusts the overall bright effect of HDR.|
||Sets the tonemap rate.|
||Sets the tonemap scale|
||Sets the maximum scale|
||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.
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. Heres how it looks:
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 entities. Meaning neither
env_sprite nor regular light entities are required anymore.