HDR Lighting Settings

From Valve Developer Community
Jump to: navigation, search

Overview

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

Use a logic_auto to set env_tonemap_controller values. Click to enlarge.

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:

SetAutoExposureMax

  • Sets the brightest level the exposure will go.

SetAutoExposureMin

  • sets the darkest level the exposure will go.

SetBloomScale

  • sets the bloom scale in the level.

Important Note

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

You can also use triggers to set env_tonemap_controller values. Click to enlarge.

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.

Note:Because the env_tonemap_controller affects all clients, triggering them in this way is generally only suitable for single-player games.

Adding different lighting values for LDR and HDR modes

Separate HDR values can be set for light_environment entities. Click to enlarge.

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 due to 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 help in this regard.

Environment lights

Here is a screenshot of the light_environment entity with the HDR settings. The default values for BrightnessHDR, and AmbientHDR are (-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

Separate HDR values can be set for texture light using lights.rad. Click to enlarge.

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.

Other lights

Other types of Source lights, including light and light_spot, also have HDR values. You can set the HDR values for these lights in the same way you set the light for light_environment entities.

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.

mat_dynamic_tonemapping 0/1 (default 1)

  • Enables or disables dynamic (automatic) HDR tonemapping.

mat_autoexposure_max 0-20 (default 2)

  • Sets the brightest (maximum) exposure that will be reached. Values over 20 should not be used in most cases.

mat_autoexposure_min 0-20 (default .5)

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

mat_hdr_tonemapscale 0-20

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

mat_disablebloom 0/1 (default 1)

  • Disables blooming.

mat_bloomscale 0-16 (default 1)

  • Sets the amount (scale) of HDR blooming. Higher values equal more blooming. Values beyond 16 should not be used in most cases.

See also

HDR Lighting Basics

HDR Skybox Creation

env_tonemap_controller