env_fog_controller

From Source Entities
Jump to navigation Jump to search

Code classes:

Env fog controller.png

env_fog_controller is a point entity present in all Source games. It determines the properties of aerial fog. Multiple may exist in one map in order to change settings at any time. Fog may be changed as players enter different areas by sending the player entity (probably best accessed through !activator and a trigger) a SetFogController input. For L4d.png onward, fog_volume can do this automatically.

Tip: There are additional ways to convey that an area is foggy:

  • Falloff - (or attenuation) is the rate at which light intensity decreases over distance. Light reaches shorter distances in fog.
  • Tyndall effects - can be seen when the fog particles reflect light toward the viewer. Halos and light beams become more visible as fog gets thicker.
  • Diffused Lighting - the boundary-line between light and shadow becomes more blurred (diffuse) as fog gets thicker. See light_environment's SunSpreadAngle (SunSpreadAngle) and shadow_control's Maximum Distance (distance) keyvalue.

Older Source games render fog as a plane a certain distance away from the camera. This method is bad, as rotating the camera will strengthen or weaken the apparent amount of fog in a particular spot, even though the viewer hasn't moved at all. In L4d.png onward, this is fixed by implementing a new radial method which is independent from the viewing angle.

Note: The 3D Skybox fog levels set by the sky_camera parameters should correspond to your env_fog_controller settings.

Flags[edit | edit source]

  • 1: Master - Makes this controller the one players listen to on start. Equivalent to sending the player the SetFogController input. When using fog_volume, players will see this fog controller when not in any volume.

Keyvalues[edit | edit source]

Fog Enabled (fogenable) <boolean>
Makes fog start active.
Fog Start (fogstart) <float>
How far away from the viewer the fog should start.
Fog End (fogend) <float>
How far away from the viewer the fog reaches Fog Max Density.
Fog Max Density (fogmaxdensity) <float>
Maximum density the fog may reach. Expressed as a decimal percent, so for 45% put 0.45.
Far Z Clip Plane (farz) <integer>
Anything beyond this distance in world units will not be rendered. This should be higher than Fog End. If this is used, Fog Max Density should be set to 1 otherwise far-away areas will look odd.
Primary Fog Color (fogcolor) <color255>
Fog Color.
Secondary Fog Color (fogcolor2) <color255>
Secondary Fog Color. If Fog Blend is disabled, this color will never appear.
Fog Blend (fogblend) <boolean>
Enables color blending between Primary Fog Color and Secondary Fog Color. When the viewer looks in the Primary Fog Direction, fog will appear as the Primary color. When looking away from the specified direction, fog appears as the Secondary color. If the camera is not pointed directly at or away from the direction, a blend of the two colors will result.
Primary Fog Direction (fogdir) <vector>
Direction which the viewer camera is checked against to figure out the blend between the primary and secondary fog colors.
Use Angles for Fog Dir (use_angles) <boolean>
Use Pitch Yaw Roll for the Fog Blend direction instead of Primary Fog Direction.
Interpolate time (foglerptime) <float>
Fade time for the StartFogTransition input.
HDR Color Scale (Not in FGD) (HDRColorScale) <float> (available in all games since L4d.png)
Multiplier for fog color when in HDR mode. Useless because every game it's in forces HDR anyway.
Zoom Fog Scale (ZoomFogScale) <float> (only available in Csgo-small.png)
Multiplies the fog start and end distances when the player is looking through a gun's scope (such as the AWP). Does not work with numbers below 1.
Minimum DX Level (mindxlevel) to Maximum DX Level (maxdxlevel) <choices> (only available in games before Left 4 Dead)
Very outdated settings. Their functionality seems to no longer be fully intact. Nearly all players will be at the highest setting anyway because DirectX 8 has been obsolete since 2002. This is still in the FGD for Alien Swarm, but it doesn't use it.
Minimum CPU Level (mincpulevel) to Maximum CPU Level (maxcpulevel) <choices> (available in all games since L4d.png)
A user with the "effect detail" setting not in this specific range will not see this object.
  • 0: Default
  • 1: Low
  • 2: Medium
  • 3: High
Minimum GPU Level (mingpulevel) to Maximum GPU Level (maxgpulevel) <choices> (available in all games since L4d.png)
A user with the "shader detail" setting not in this specific range will not see this object. Settings are named differently in different games.
  • 0: Default
  • 1: Very low or Low
  • 2: Low or Medium
  • 3: Medium or High
  • 4: High or Very High

Inputs[edit | edit source]

TurnOn
Turns the fog on.
TurnOff
Turns the fog off, meaning none appears at all if this is the controller being listened to.
SetStartDist <float>
Sets Fog Start.
SetEndDist <float>
Sets Fog End.
SetColor <color255>
Sets Primary Fog Color.
SetColorSecondary <color255>
Sets Secondary Fog Color.
SetFarZ <integer>
Sets Far Z Clip Plane.
SetMaxDensity (Not in FGD) <float>
Sets Fog Max Density.
SetAngles <angle>
Sets Primary Fog Direction.
SetColorLerpTo <color255>
Stores a value for Primary Fog Color that is set once the StartFogTransition input is sent.
SetColorSecondaryLerpTo <color255>
Stores a value for Secondary Fog Color that is set once the StartFogTransition input is sent.
SetStartDistLerpTo <float>
Stores a value for Fog Start that is set once the StartFogTransition input is sent.
SetEndDistLerpTo <float>
Stores a value for Fog End that is set once the StartFogTransition input is sent.
StartFogTransition
When fired, the fog fades to any new values sent through the "LerpTo" inputs. Fade time is determined by the Interpolate time keyvalue.
Bug: If not specified by the input associated with them, the lerpto values for the distances and the max density (only in L4d.png and later) will be zero, so fog will inch closer and closer to the camera while also fading to nothing, then go back to normal once the transition is over.
Fix: Send those otherwise unused inputs with their normal values.
Bug: Hl2.pngIn uncertain circumstances the fog will invert the area it colors for a split second.
SetMaxDensityLerpTo (Not in FGD) <float> (available in all games since L4d.png)
Stores a value for Fog Max Density that is set once the StartFogTransition input is sent.
Set2DSkyboxFogFactor <float> (only available in L4d2-small.png)
Set the current amount of fog to blend into the 2D skybox. Expressed as a decimal percent, so for 45% put 0.45.
Set2DSkyboxFogFactorLerpTo <float> (only available in L4d2-small.png)
Set the current amount of fog to blend into the 2D skybox. Expressed as a decimal percent, so for 45% put 0.45. This will only change once the StartFogTransition input fires.
SetZoomFogScale <float> (only available in Csgo-small.png)
Sets Zoom Fog Scale.

See Also[edit | edit source]