Env fade: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(updates)
Line 1: Line 1:
{{otherlang2
{{lang|Env fade}}
|ru=env_fade:ru
[[File:env_fade.png|left|link=]]{{base point|env_fade}} It controls screen fades to or from a solid color.  Add '''Duration''' and '''Hold Time''' together for the total time this entity will be in effect.
}}


{{base point|env_fade}}  
{{code class|CEnvFade|EnvFade.cpp}}


==Entity description==
{{clr}}
[[File:env_fade.png|left|link=]]
It controls screen fades. Screen fades are used to blend regular game imagery to or from a solid color.  Add '''duration''' and '''holdtime''' together for the total time this entity will be in effect.
The modulate flag on <code>env_fade</code> uses a different kind of blending to achieve the fade. The normal fade does a straight weighted blend between the screen and the fading color (i.e. the fade color becomes a more/less opaque overlay over the scene). Modulate actually attenuates the screen colors in RGB with the fade color. So you could, for example, remove all of the red and blue from a scene with modulate and be left with a green overlay - well, sort of night vision anyway. The fade color for that would be pure green with modulate.{{clr}}
{{Note|This effect can also be achieved by using the console commands <code>fadeout</code> and <code>fadein</code>. The default transition time is 2 seconds. You can supply other parameters in curly brackets like <code>fadeout {time r g b}</code>.}}
== Keyvalues ==
{{KV|Duration (seconds)|string|The time that it will take to fade the screen in or out.}}
{{KV|Hold Fade (seconds)|string|The time to hold the faded in/out state.}}
{{KV|Fade Alpha|integer|Alpha of the fade, where 0 {{=}} fully transparent and 255 {{=}} fully opaque.}}
{{KV|Fade Color (R G B)|color255|Fade color.}}
{{KV|Reverse Fade Duration (seconds)|float|The duration of the reverse fade.|since=P2}}
{{KV Targetname}}


== Flags ==  
==ConVars/Commands==
[[File:Env fade flag 4.jpg|thumb|150px|right|The Flags menu will show this for Flag 4 (Turn off SmartEdit and type spawnflags 4).]]
{{varcom|start}}
* 1 : Fade From
{{varcom|fadein|float int int int 0|Time (seconds), Red, Green, Blue, {{todo}}|Makes the screen black (or the specified color), then fades to the normal view. {{todo|Why is the last number required?}}}}
:Essentially a "fade in," where the screen begins from an opaque color.  
{{varcom|fadeout|float int int int 0|Time (seconds), Red, Green, Blue, {{todo}}|Fades the screen to black (or the specified color). {{todo|Why is the last number required?}}}}
* 2 : Modulate
{{varcom|end}}
:Use attenuation blending, see [[#Entity Description|Entity Description]].
 
* 4 : Triggering player only  
==Flags==
:Only affect activator.
*1: Fade From - Screen fades ''from'' the specified color instead of ''to'' it.
:{{note|This flag exists in all Source games, but isn't listed in the FGDs for some, if you don't want to edit the FGD to get it, just add 4 to your current spawnflags.}}
*2: Modulate - Uses attenuation blending to achieve the fade. The normal fade does a straight weighted blend between the screen and the fading color. Modulate actually attenuates the RGB channels. For example, a color of <code>0 255 0</code> would mute the red and blue channels and create a green nightvision-type effect.
* 8 : Stay Out
*4: Triggering player only {{not in FGD}} - Only affects the screen of the {{ent|!activator}}. <code>!activator</code> is probably the easiest to reach through a [[trigger]] entity. If not checked, the fade will apply to all players.
:The fade remains indefinitely until another fade deactivates it. This prevents the ondeath-fadeout used in Portal 2.
*8: Stay Out - Fade remains indefinitely until another fade deactivates it.
 
==Keyvalues==
{{KV|Duration (seconds) (duration)|string|The time that it will take to fade the screen in or out.}}
{{KV|Hold Fade (seconds) (holdtime)|string|The time to hold the faded in/out state.}}
{{KV|Fade Alpha (renderamt)|integer|Alpha of the fade, where 0 {{=}} fully transparent and 255 {{=}} fully opaque.}}
{{KV|Fade Color (R G B) (rendercolor)|color255|Fade color.}}
{{KV|Reverse Fade Duration (seconds) (ReverseFadeDuration)|float|The duration of the reverse fade.|since=P2}}
{{KV BaseEntity|css=1}}


==Inputs==
==Inputs==
{{IO|Fade|Start the screen fade.}}
{{IO|Fade|Start the screen fade.}}
{{IO|FadeReverse|Begin doing the reverse of the current fade.|since=P2}}
{{IO|FadeReverse|Begin doing the reverse of the current fade.|since=P2}}
{{I Targetname}}
{{IO|Alpha|nofgd=1|Changes '''Fade Alpha'''.}}
{{IO|Color|nofgd=1|Changes '''Fade Color'''.}}
{{I BaseEntity|prel4d=1}}


==Outputs==
==Outputs==
{{IO|OnBeginFade|Fired when the fade has begun.}}
{{IO|OnBeginFade|Fired when the fade has begun.}}
{{O Targetname}}
{{O BaseEntity|l4d=1}}


[[Category:GUI Entities]]
[[Category:GUI Entities]]

Revision as of 12:34, 24 September 2018

English (en)Русский (ru)中文 (zh)Translate (Translate)
Env fade.png

Template:Base point It controls screen fades to or from a solid color. Add Duration and Hold Time together for the total time this entity will be in effect.

C++ In code, it is represented by theCEnvFadeclass, defined in theEnvFade.cppfile.

ConVars/Commands

Cvar/Command Parameters or default value Descriptor Effect
fadein float int int int 0 Time (seconds), Red, Green, Blue, [Todo] Makes the screen black (or the specified color), then fades to the normal view.
Todo: Why is the last number required?
fadeout float int int int 0 Time (seconds), Red, Green, Blue, [Todo] Fades the screen to black (or the specified color).
Todo: Why is the last number required?

Flags

  • 1: Fade From - Screen fades from the specified color instead of to it.
  • 2: Modulate - Uses attenuation blending to achieve the fade. The normal fade does a straight weighted blend between the screen and the fading color. Modulate actually attenuates the RGB channels. For example, a color of 0 255 0 would mute the red and blue channels and create a green nightvision-type effect.
  • 4: Triggering player only !FGD - Only affects the screen of the !activator. !activator is probably the easiest to reach through a trigger entity. If not checked, the fade will apply to all players.
  • 8: Stay Out - Fade remains indefinitely until another fade deactivates it.

Keyvalues

Duration (seconds) (duration) ([todo internal name (i)]) <string>
The time that it will take to fade the screen in or out.
Hold Fade (seconds) (holdtime) ([todo internal name (i)]) <string>
The time to hold the faded in/out state.
Fade Alpha (renderamt) ([todo internal name (i)]) <integer>
Alpha of the fade, where 0 = fully transparent and 255 = fully opaque.
Fade Color (R G B) (rendercolor) ([todo internal name (i)]) <color255>
Fade color.
Reverse Fade Duration (seconds) (ReverseFadeDuration) ([todo internal name (i)]) <float> (in all games since Portal 2)
The duration of the reverse fade.


Inputs

Fade
Start the screen fade.
FadeReverse  (in all games since Portal 2)
Begin doing the reverse of the current fade.
Alpha  !FGD
Changes Fade Alpha.
Color  !FGD
Changes Fade Color.


Outputs

OnBeginFade
Fired when the fade has begun.