HDR Lighting Settings: Difference between revisions
No edit summary |
Kestrelguy (talk | contribs) m (updated language bar. also some formatting.) |
||
Line 1: | Line 1: | ||
{{ | {{lang|HDR Lighting Settings}}{{source topicon}}[[Category:Level Design]][[Category:Lighting]] | ||
| | |||
}} | |||
[[Category:Level Design]] | |||
== Overview == | == 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. | 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 | ==Add a Custom <tt>env_tonemap_controller</tt>== | ||
[[Image:hdr_logic_auto.png|thumb|250px|Use a {{ent|logic_auto}} to set <tt>env_tonemap_controller</tt> values. Click to enlarge.]] | |||
[[Image:hdr_logic_auto.png|thumb|250px|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 | Our example map also contains the entities to demonstrate the HDR effects. The first entity that needs to be placed is an {{ent|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 <tt>tonemap</tt>. | ||
Now we can trigger this entity a couple of ways, here we show a <code>logic_auto</code> entity that was used to set the settings on level spawn. The Inputs on <code>env_tonemap_controller</code> that are of interest are: | Now we can trigger this entity a couple of ways, here we show a <code>logic_auto</code> entity that was used to set the settings on level spawn. The Inputs on <code>env_tonemap_controller</code> that are of interest are: | ||
<code>SetAutoExposureMax</code> | ;<code>SetAutoExposureMax</code>:Sets the brightest level the exposure will go. | ||
;<code>SetAutoExposureMin</code>:Sets the darkest level the exposure will go. | |||
;<code>SetBloomScale</code>:Sets the bloom scale in the level. | |||
<code>SetAutoExposureMin</code> | |||
<code>SetBloomScale</code> | |||
=== Important Note === | === Important Note === | ||
If the level is using an {{ent|env_tonemap_controller}}, console commands used to change HDR values '''cannot be used directly'''. Instead, the <tt>env_tonemap_controller</tt> entity inputs must be fired to change the settings. This can be done via standard [[Inputs and Outputs|entity I/O]] or using the <code>ent_fire</code> command with the following format: | |||
If the level is using an | |||
<pre>ent_fire <env_tonemap_controller name> <input name> <new value></pre> | <pre>ent_fire <env_tonemap_controller name> <input name> <new value></pre> | ||
For example, if your <code>env_tonemap_controller</code> is named < | For example, if your <code>env_tonemap_controller</code> is named <tt>tonemap_global</tt>, you would use the following commands: | ||
<pre> | <pre> | ||
Line 39: | Line 27: | ||
</pre><br style="clear:both"> | </pre><br style="clear:both"> | ||
== Adding a | ==Adding a Triggerable <tt>env_tonemap_controller</tt>== | ||
[[Image:hdr_trigger_multiple.png|thumb|250px|You can also use triggers to set <tt>env_tonemap_controller</tt> values. Click to enlarge.]] | |||
[[Image:hdr_trigger_multiple.png|thumb|250px|You can also use triggers to set env_tonemap_controller values. Click to enlarge.]] | |||
The <tt>env_tonemap_controller</tt> can also be triggered with a {{ent|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 <code>env_tonemap_controller</code> affects all clients, triggering them in this way is generally only suitable for single-player games.}}<br style="clear:both"> | {{note|Because the <code>env_tonemap_controller</code> affects all clients, triggering them in this way is generally only suitable for single-player games.}}<br style="clear:both"> | ||
== Adding | == Adding Different Lighting Values for LDR and HDR Modes == | ||
[[Image:hdr_light_env.png|thumb|250px|Separate HDR values can be set for {{ent|light_environment}} entities. Click to enlarge.]] | |||
[[Image:hdr_light_env.png|thumb|250px|Separate HDR values can be set for light_environment entities. Click to enlarge.]] | |||
<code> | All entity lights and texture lights using <code>lights.rad</code> 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. | ||
<code> | === Environment Lights === | ||
Here is a screenshot of the {{ent|light_environment}} entity with the HDR settings. The default values for <code>BrightnessHDR</code> and <code>AmbientHDR</code> are <code>(-1, -1, -1, 1)</code>, which means to use the same settings as LDR. To change the HDR values, just enter your new values into these fields.<br style="clear:both"> | |||
=== HDR Texture Lights === | |||
[[Image:hdr_lights_rad.png|thumb|250px|Separate HDR values can be set for texture light using {{ent|lights.rad}}. Click to enlarge.]] | |||
The <tt>lights.rad</tt> file, which controls "texture" light values, also allows for an independent HDR setting. The highlighted numbers above shows how the 2<sup>nd</sup> set of 4 numbers apply to the HDR values (R, G, B, intensity), if a 2<sup>nd</sup> set of numbers isn't entered vrad will use the LDR settings by default.<br style="clear:both"> | |||
=== Other Lights === | |||
Other types of Source lights, including {{ent|light}} and {{ent|light_spot}}, also have HDR values. You can set the HDR values for these lights in the same way you set the light for <tt>light_environment</tt> 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. | |||
{{varcom|start}} | |||
{{varcom|mat_dynamic_tonemapping|1|01|Enables or disables dynamic (automatic) HDR tonemapping.}} | |||
{{varcom|mat_autoexposure_max|2|Float 0–20|Sets the brightest (maximum) exposure that will be reached. Values over 20 should not be used in most cases.}} | |||
{{varcom|mat_autoexposure_min|0.5|Float 0–20|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.}} | |||
{{varcom|mat_hdr_tonemapscale||Float 0–20|For use when <code>mat_dynamic_tonemapping</code> is set to 0 (off). Sets a single explicit exposure setting. Values over 20 should not be used in most cases.}} | |||
{{varcom|mat_disablebloom|1|01|Disables blooming.}} | |||
{{varcom|mat_bloomscale|1|Float 0–16|Sets the amount (scale) of HDR blooming. Higher values equal more blooming. Values beyond 16 should not be used in most cases.}} | |||
{{varcom|end}} | |||
[[ | == See Also == | ||
* [[HDR Lighting Basics]] | |||
* [[HDR Skybox Creation]] | |||
* {{ent|env_tonemap_controller}} |
Revision as of 10:38, 3 June 2022
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

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

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

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

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.
Cvar/Command | Parameters or default value | Descriptor | Effect |
---|---|---|---|
mat_dynamic_tonemapping | 1 | 0 disables, 1 enables | Enables or disables dynamic (automatic) HDR tonemapping. |
mat_autoexposure_max | 2 | Float 0–20 | Sets the brightest (maximum) exposure that will be reached. Values over 20 should not be used in most cases. |
mat_autoexposure_min | 0.5 | Float 0–20 | 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 | Float 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 | 1 | 0 disables, 1 enables | Disables blooming. |
mat_bloomscale | 1 | Float 0–16 | Sets the amount (scale) of HDR blooming. Higher values equal more blooming. Values beyond 16 should not be used in most cases. |