HDR Lighting Settings
This article explains some of the more advanced techniques that can be used with HDR lighting. See HDR Lighting Basics for a description of the standard HDR methods.
Add a Custom env_tonemap_controller
Our example map also contains the entities to demonstrate the HDR effects. The first entity that needs to be placed is an
env_tonemap_controller. This entity can control the HDR settings in the map and allows us to override the default HDR values. Go ahead and name it tonemap.
Now we can trigger this entity a couple of ways, here we show a
logic_auto entity that was used to set the settings on level spawn. The Inputs on
env_tonemap_controller that are of interest are:
- Sets the brightest level the exposure will go.
- Sets the darkest level the exposure will go.
- Sets the bloom scale in the level.
If the level is using an
env_tonemap_controller, console commands used to change HDR values cannot be used directly. Instead, the env_tonemap_controller entity inputs must be fired to change the settings. This can be done via standard entity I/O or using the
ent_fire command with the following format:
ent_fire <env_tonemap_controller name> <input name> <new value>
For example, if your
env_tonemap_controller is named tonemap_global, you would use the following commands:
ent_fire tonemap_global SetBloomScale 3 ent_fire tonemap_global SetAutoExposureMax 6 ent_fire tonemap_global SetAutoExposureMin .8
Adding a Triggerable env_tonemap_controller
The env_tonemap_controller can also be triggered with a
trigger_multiple. Here we see a trigger that changes the HDR values when the player enters the house. We state that this is single-player only because if these values change they would change globally affecting all players.
Adding Different Lighting Values for LDR and HDR Modes
All entity lights and texture lights using
lights.rad have the ability to contain two sets of lighting for LDR + HDR. In general, HDR lighting needs to be slightly less intense than the LDR values for a couple of reasons. Firstly, HDR has auto exposure to compensate for the darker areas and brighten the spaces. Secondly, bloom effects have the tendency to over-brighten certain surfaces, so toning down the light values also helps in this regard.
Here is a screenshot of the
light_environment entity with the HDR settings. The default values for
(-1, -1, -1, 1), which means to use the same settings as LDR. To change the HDR values, just enter your new values into these fields.
HDR Texture Lights
The lights.rad file, which controls "texture" light values, also allows for an independent HDR setting. The highlighted numbers above shows how the 2nd set of 4 numbers apply to the HDR values (R, G, B, intensity), if a 2nd set of numbers isn't entered vrad will use the LDR settings by default.
More HDR Console Commands
Here is a list of commands that can be used at the console to dynamically edit your HDR settings in the engine.
|Parameters or default value
|0 disables, 1 enables
|Enables or disables dynamic (automatic) HDR tonemapping.
|Sets the brightest (maximum) exposure that will be reached. Values over 20 should not be used in most cases.
|Where 0 is darkest (minimum) exposure level that will be reached. Values over 20 should not be used in most cases. Typical values are less than 1.
|For use when
mat_dynamic_tonemapping is set to 0 (off). Sets a single explicit exposure setting. Values over 20 should not be used in most cases.
|0 disables, 1 enables
|Sets the amount (scale) of HDR blooming. Higher values equal more blooming. Values beyond 16 should not be used in most cases.