This article's documentation is for anything that uses the Source engine. Click here for more information.

Env tonemap controller: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Many reason.)
mNo edit summary
Line 3: Line 3:
{{CD|CEnvTonemapController|file1=env_tonemap_controller.cpp}}
{{CD|CEnvTonemapController|file1=env_tonemap_controller.cpp}}
{{This is a|logical entity|name=env_tonemap_controller|sprite=1}}__NOTOC__
{{This is a|logical entity|name=env_tonemap_controller|sprite=1}}__NOTOC__
It controls the [[HDR]] tonemapping for the player. Think of it as a method of controlling the exposure of the player's eyes. Tonemapping affect all players in multiplayer. HDR settings should normally be changed through [[triggers]], whenever transitioning between environments of different light levels (or for multiplayer, at the start of the map via {{ent|logic_auto}} and to control tonemapping for individual players use {{ent|trigger_tonemap}}).  
It controls the [[HDR]] tonemapping for the player. Think of it as a method of controlling the exposure of the player's eyes. Tonemapping affect all players in multiplayer. HDR settings should normally be changed through [[triggers]], whenever transitioning between environments of different light levels (or for multiplayer, at the start of the map via {{ent|logic_auto}} and to control tonemapping for individual players use {{ent|trigger_tonemap}}).
{{clr}}
{{clr}}
{{tip|{{l4dseries|4}} has <code>env_tonemap_controller_ghost</code> and <code>env_tonemap_controller_infected</code> which are identical with a difference that <br>Env_tonemap_controller_ghost affects not yet spawned SI player. <br>Env_tonemap_controller_infected affects spawned SI players.}}
{{tip|The {{l4dseries|4}} has <code>env_tonemap_controller_ghost</code> (which affects yet-unspawned SI players) and <code>env_tonemap_controller_infected</code> (which affects ones that have spawned).}}
{{Expand|title=Non-Valve games {{bms}}|
{{Expand|title=Non-Valve games {{bms}}|
{{note|{{bms|4}} use upgraded tonemapping with bloom which use a modified version of the Reinhard filter (in the game it is called next <code>Next Generation Bloom</code>, or <code>Next Gen Bloom</code> for short). Because of this, the results are very different from other {{Source|4|nt=1}} games. Old bloom and [[HDR]] still can be enabled with <code>mat_bloom_nextgen 1</code>.}}
{{note|{{bms|4}} uses upgraded tonemapping with bloom using a modified version of the Reinhard filter (in the game it is called next <code>Next Generation Bloom</code>, or <code>Next Gen Bloom</code> for short). Because of this, the results are very different from other {{Source|4|nt=1}} games. Old bloom and [[HDR]] still can be enabled with <code>mat_bloom_nextgen 1</code>.}}
{{important|If this entity is not in a map - <code>Next Gen Bloom</code> from {{bms|4}} will be broken if map is launched on a dedicated server (just like in the picture). There is probably a mechanism in the game that makes normal HDR if there is no [[env_tonemap_controller]] on a map, because when you run a map locally, everything looks fine. Probably this mechanism worked before with dedicated servers, but in the final release, something is broken. This is why you must to put this entity if you are creating a map for {{bms|4}} multiplayer.
{{important|If this entity is not in a map - <code>Next Gen Bloom</code> from {{bms|4}} will be broken if the map is launched on a dedicated server (just like in the picture). There is probably a mechanism in the game that makes normal HDR if there is no [[env_tonemap_controller]] on a map, because when you run a map locally, everything looks fine. Probably this mechanism worked before with dedicated servers, but in the final release, something is broken. This is why you must to put this entity if you are creating a map for {{bms|4}} multiplayer.
{{Expand|title=Examples.|
{{Expand|title=Examples.|
<br>
<br>
Line 75: Line 75:
<br>
<br>
<gallery mode=packed heights=410px>
<gallery mode=packed heights=410px>
File:BloomT0=.jpg| frame | left | 510px | 0 (Very high values are used here for RGB)
File:BloomT0=.jpg| frame | left | 510px | 0 (Very high values are used here for RGB)
File:BloomT1=.jpg| frame | left | 510px | 20
File:BloomT1=.jpg| frame | left | 510px | 20
</gallery>
</gallery>
}}
}}
Line 83: Line 83:
<br>
<br>
<gallery mode=packed heights=410px>
<gallery mode=packed heights=410px>
File:BloomR0=.jpg| frame | left | 510px | Default.
File:BloomR0=.jpg| frame | left | 510px | Default.
File:BloomR1=.jpg| frame | left | 510px | 20 (blue and green is 0 here)
File:BloomR1=.jpg| frame | left | 510px | 20 (blue and green is 0 here)
</gallery>
</gallery>
}}
}}
Line 91: Line 91:
<br>
<br>
<gallery mode=packed heights=410px>
<gallery mode=packed heights=410px>
File:BloomR0=.jpg| frame | left | 510px | Default values.
File:BloomR0=.jpg| frame | left | 510px | Default values.
File:BloomG1=.jpg| frame | left | 510px | 20 (blue and red is 0 here)
File:BloomG1=.jpg| frame | left | 510px | 20 (blue and red is 0 here)
</gallery>
</gallery>
}}
}}
Line 99: Line 99:
<br>
<br>
<gallery mode=packed heights=410px>
<gallery mode=packed heights=410px>
File:BloomR0=.jpg| frame | left | 510px | Default values.
File:BloomR0=.jpg| frame | left | 510px | Default values.
File:BloomB1=.jpg| frame | left | 510px | 20 (red and green is 0 here)
File:BloomB1=.jpg| frame | left | 510px | 20 (red and green is 0 here)
</gallery>
</gallery>
}}
}}
Line 107: Line 107:
<br>
<br>
<gallery mode=packed heights=410px>
<gallery mode=packed heights=410px>
File:BloomE0=.jpg| frame | left | 510px | 0 (Threshold very hight here)
File:BloomE0=.jpg| frame | left | 510px | 0 (Threshold very hight here)
File:BloomE1=.jpg| frame | left | 510px | 0.5
File:BloomE1=.jpg| frame | left | 510px | 0.5
</gallery>
</gallery>
}}
}}

Revision as of 02:30, 27 May 2025

English (en)Translate (Translate)
Todo: Split Black Mesa and Valve games to separate pages.
C++ Class hierarchy
CEnvTonemapController
CPointEntity
CBaseEntity
C++ env_tonemap_controller.cpp
Env tonemap controller.png

env_tonemap_controller is a logical entity available in all Source Source games.

It controls the HDR tonemapping for the player. Think of it as a method of controlling the exposure of the player's eyes. Tonemapping affect all players in multiplayer. HDR settings should normally be changed through triggers, whenever transitioning between environments of different light levels (or for multiplayer, at the start of the map via logic_auto and to control tonemapping for individual players use trigger_tonemap).

Tip.pngTip:The Left 4 Dead seriesLeft 4 Dead series Left 4 Dead series has env_tonemap_controller_ghost (which affects yet-unspawned SI players) and env_tonemap_controller_infected (which affects ones that have spawned).
Non-Valve games Black Mesa
Note.pngNote:Black Mesa Black Mesa uses upgraded tonemapping with bloom using a modified version of the Reinhard filter (in the game it is called next Next Generation Bloom, or Next Gen Bloom for short). Because of this, the results are very different from other Source Source Engine games. Old bloom and HDR still can be enabled with mat_bloom_nextgen 1.
Icon-Important.pngImportant:If this entity is not in a map - Next Gen Bloom from Black Mesa Black Mesa will be broken if the map is launched on a dedicated server (just like in the picture). There is probably a mechanism in the game that makes normal HDR if there is no env_tonemap_controller on a map, because when you run a map locally, everything looks fine. Probably this mechanism worked before with dedicated servers, but in the final release, something is broken. This is why you must to put this entity if you are creating a map for Black Mesa Black Mesa multiplayer.
Examples.


Flags

Master (Has priority if multiple env_tonemap_controller entities exist) : [1] (in all games since Left 4 Dead)

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Non-Valve games Black Mesa
bUseNextGenBloom (bUseNextGenBloom) <choices>
  • 0: NO
  • 1: YES
bUseCusBloomNG_Threshold (bUseCusBloomNG_Threshold) <choices>
  • 0: NO
  • 1: YES
Icon-Important.pngImportant:Most new Black Mesa Black Mesa keyvalues and I/O doesn't work if this keyvalue use choice NO.
Examples


fCusBloomNG_Threshold (fCusBloomNG_Threshold) <float>
Threshold for bright pass filter. Determines the influence of tonemapping; with high values, only brightest parts of frame will be bloomed.
Note.pngNote:The default value from fgd is 1, which is incorrect. The default value is 0.1.
Note.pngNote:A value of 0 means all pixels contribute to bloom, and is considered the most physically accurate setting.
bUseCusBloomNG_tintExponent (bUseCusBloomNG_tintExponent) <choices>
  • 0: NO
  • 1: YES
m_fCustomBloomNextGen_r (m_fCustomBloomNextGen_r) <float>
Determines the influence for reder tones in frame.
Note.pngNote:The default value from fgd is 1, which is incorrect. The default value is 0.25.
m_fCustomBloomNextGen_g (m_fCustomBloomNextGen_g) <float>
Determines the influence for greener tones in frame.
Note.pngNote:The default value from fgd is 1, which is incorrect. The default value is 0.25.
m_fCustomBloomNextGen_b (m_fCustomBloomNextGen_b) <float>
Determines the influence for bluer tones in frame.
Note.pngNote:The default value from fgd is 1, which is incorrect. The default value is 0.25.
m_fCusBloomNG_exponent (m_fCusBloomNG_exponent) <float>
Determines the tightness of the bloom.
Note.pngNote:The default value from fgd is 1, which is incorrect. The default value is 2.2.

Inputs

SetTonemapScale <floatRedirectInput/float> (not in Counter-Strike: Global Offensive)
Sets the player's tonemap scale. It should be a value between 0 and 2, where 0 is the eyes fully closed, 1 is use the unchanged autoexposure (default), and 2 is the eye fully wide open.
Icon-Bug.pngBug:This input does nothing. It only changes mat_hdr_tonemapscale on the client, which is a value that's written but never read  [todo tested in ?]
BlendTonemapScale <stringRedirectInput/string> (not in Counter-Strike: Global Offensive)
Blends from the player's current tonemap scale to a new one. The parameter syntax is as follows: <target tonemap scale> <blend duration>. For example: 0.5 10 would blend from the current tonemap scale to 0.5 over a period of 10 seconds.
Icon-Bug.pngBug:This input does nothing, same reason as above  [todo tested in ?]
UseDefaultAutoExposure
Reverts to using the default tonemap auto exposure.
UseDefaultBloomScale  !FGD
Reverts to using the default bloom scale.
SetAutoExposureMin <floatRedirectInput/float>
Sets a custom tonemap auto exposure minimum. Default is 0.5.
SetAutoExposureMax <floatRedirectInput/float>
Sets a custom tonemap auto exposure maximum. Default is 2.0.
SetBloomScale <floatRedirectInput/float>
Sets a custom bloom scale.
SetBloomScaleRange <vector2> !FGD
Sets a range for the bloom scale. First number is the maximum, second number is the minimum.
Note.pngNote:Minimum value is unused, so effectively same as SetBloomScale
SetTonemapRate <floatRedirectInput/float>
Sets the rate for autoexposure adjustment (mat_hdr_manual_tonemap_rate).
Icon-Bug.pngBug:The convar is not replicated so it only works in singleplayer. The changed value persists across map changes as a result. Both of these were fixed in Counter-Strike: Global Offensive.  [todo tested in ?]
SetBloomExponent <floatRedirectInput/float> (in all games since Left 4 Dead)
Sets a custom bloom exponent.
SetBloomSaturation <floatRedirectInput/float> (in all games since Left 4 Dead)
Sets a custom bloom saturation.
SetTonemapPercentBrightPixels <floatRedirectInput/float> (only in Left 4 Dead 2 Counter-Strike: Global Offensive)
Sets a target percentage of pixels to maintain above a certain brightness. (default: 1)
SetTonemapPercentTarget <floatRedirectInput/float> (only in Left 4 Dead 2 Counter-Strike: Global Offensive)
Sets the brightness that the percentage of pixels defined by SetTonemapPercentBrightPixels should be kept above. (default: 45)
SetTonemapMinAvgLum <floatRedirectInput/float> (only in Left 4 Dead 2 Counter-Strike: Global Offensive)
Sets custom tonemapping param (default: 3).[Clarify]
Non-Valve games Black Mesa
InputSetBloomNxtGen_Threshold <floatRedirectInput/float>
Sets the influence of tonemapping; with high values, only brightest parts of frame will be bloomed.
An example of what it does.


InputSetBloomNxtGen_TintR <floatRedirectInput/float>
Sets the influence value for redder tones in frame.
An example of what it does.


InputSetBloomNxtGen_TintG <floatRedirectInput/float>
Sets the influence value for greener tones in frame.
An example of what it does.


InputSetBloomNxtGen_TintB <floatRedirectInput/float>
Sets the influence value for bluer tones in frame.
An example of what it does.


InputSetBloomNxtGen_Exponent <floatRedirectInput/float>
Sets the brightness of the bloom.
An example of what it does.


See also