env_fog_controlleris a point entity available in all Source games. It determines the properties of aerial fog for the whole map.
playerentity (probably best accessed through
SetFogControllerinput. (Also applies to single player sessions, like in )
In , multiple
env_fog_controllers may be used in conjunction with
fog_volumes to create different fog effects where needed. In addition, an
env_fog_controller can be set as the Master fog controller under flags, in cases where a
fog_volume is not tied to any specific
env_fog_controller, or if no
fog_volume is used in a region.
Warning: In some/all multiplayer games, this entity will intentionally not reset itself to its default properties (including position) when a new round begins. If this is an issue, use inputs to emulate resetting it.
Adding fog to a map can cause/require changes to the lighting for realism. Light is scattered and absorbed as it passes through fog. The denser the fog, the greater the effect:
- Falloff - (or attenuation) is the rate at which light intensity decreases over distance. Falloff distance decreases as fog gets thicker.
- 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 Lightmap Scale and
shadow_control's "distance" parameter.
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 Left 4 Dead[confirm] onward, this is fixed by implementing a new radial method which is independent from the viewing angle.
sky_cameraparameters should correspond to your
- 1: Master - If multiple
env_fog_controllers are active, this one will always take priority.
- Fog Enabled (fogenable)
- Make fog start active.
- Fog Start (fogstart)
- How far away from the viewer the fog should start.
- Fog End (fogend)
- How far away from the viewer the fog reaches Fog Max Density.
- Fog Max Density (fogmaxdensity)
- Maximum density the fog may reach. Expressed as a decimal percent, so for 45% put 0.45.
- Far Z Clip Plane (farz)
- 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
1otherwise the void may be visible.
- Primary Fog Color (fogcolor)
- Primary Fog Color.
- Secondary Fog Color (fogcolor2)
- Secondary Fog Color. If Fog Blend is disabled, this color will never appear.
- Fog Blend (fogblend)
- 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. Sunlight with a Yaw of 45 degrees and a Pitch of -45 degrees could be enhanced using a Primary Fog Direction of "-1 -1 1", a Primary Fog Color of "120 110 100" and a Secondary Fog Color of "80 70 60".
- Primary Fog Direction (fogdir)
- A vector (given by three space-separated numbers X Y Z) 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)
- Use Pitch Yaw Roll for the Fog Blend direction instead of Primary Fog Direction. There isn't much use for this unless you want the direction to rotate.
- Interpolate time (foglerptime)
- Fade time for the
- HDR Color Scale (HDRColorScale)
- Multiplier for fog color when in HDR mode.
- Zoom Fog Scale (ZoomFogScale)
- Scalar for fog start and end distances when the player is looking through a gun's scope (e.g. AWP).
- Minimum DX Level
- The entity will not exist if the engine is running outside the given range of DirectX Versions. Replaced by SystemLevelChoice from Left 4 Dead onwards.
- Warning: If these are used, the object may break when the user switches their DirectX settings.
- Maximum DX Level
- Minimum CPU Level
- A user with a CPU level lower than this will not see this object rendered in-game. CPU levels are determined by the Effect detail setting.
- Maximum CPU Level
- 0: Default
- 1: Low
- 2: Medium
- 3: High
- Minimum GPU Level
- A user with a GPU level lower than this will not see this object rendered in-game. GPU levels are determined by the Shader detail setting.
- Maximum GPU Level
- 0: Default
- 1: Very low
- 2: Low
- 3: Medium
- 4: High
- The classname defines the type of entity. Classnames can be changed using
AddOutput, which will influence how the engine deals with the entity in certain circumstances.
- The name that other entities refer to this entity by.
- Global Entity Name
- Name by which this entity is linked to another entity in a different map. When the player transitions to a new map, entities in the new map with globalnames matching entities in the previous map will have the previous map's state copied over their state.
- Specifies a movement parent. An entity will maintain its initial offset from its parent. An attachment point can be added to the end of the name, separated by a comma. Every entity can be parented, even point entities. Entities which are parented will be forced to transition to the next map, such as from a
trigger_transition. Some entities which aren't intended to be parented may not function correctly.
phys_constraintcan be used as a workaround to parenting.
- Origin (X Y Z)
- The position of this entity's center in the world. Rotating entities typically rotate around their origin.
- Pitch Yaw Roll (X Y Z)
- This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.Note:This works on brush entities, although Hammer doesn't show the new angles.
- Toggles features of an entity, its specific number is determined by the combination of flags added.
- Response Contexts
- Pre-defined response system contexts for this entity. Format is
key:value,key:value,.... Contexts may be filtered.
- Combination of effect flags to use.
- Local Time
- The local time of the entity, independent of the global clock. Used mainly for physics calculations.
- Next Think
- Amount of time before the entity thinks again.
- Hammer ID
- The entity's Hammer ID. Mainly used by plugins and debugging commands, such as
ent_keyvalue. Can be manually assigned with the "hammerid" or "id" keyvalue. Entities spawned at run-time are not assigned any Hammer ID.
- Disable for Xbox 360
- If Yes, disables this entity on the Xbox 360 version of Source.
- Entity Scripts
- Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
- Script think function
- Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call. Try to avoid expensive operations in this function, as it may cause performance problems.
- Lag Compensation
- Set to Yes to lag compensate this entity. Should be used very sparingly!
- Is Automatic-Aim Target
- If set to 1, this entity will slow down aiming movement for consoles and joystick controllers when the entity is under the crosshairs.
- Turns the fog on.
- Turns the fog off.
- Sets the Fog Start distance.
- Sets the Fog End distance.
- Sets the Primary Fog Color.
- Sets the Secondary Fog Color.
- Sets the Far Z Clip Plane distance.
- Sets the angles to use for the Primary Fog Direction.
- Set the current amount of fog to blend into the 2D skybox. Expressed as a decimal percent, so for 45% put 0.45. only.
- Sets the Zoom Fog Scale.
- Stores a value for Primary Fog Color that is set once the
- Stores a value for Secondary Fog Color that is set once the
- Stores a value for Fog Start that is set once the
- Stores a value for Fog End that is set once the
- Stores a value for Fog Max Density that is set once the
StartFogTransitioninput fires. This one does not have any non-"LerpTo" counterpart.
- 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
StartFogTransitioninput fires. only.
- When fired, the fog fades to any new values sent through the "
LerpTo" inputs. Fade time is determined by the Interpolate time keyvalue.
- Turns this fog on for all connected players
- Removes this entity and any entities parented to it from the world.
- Functions the same as
Kill, although this entity and any entities parented to it are killed on the same frame, being marginally faster than
- Move with this entity. See Entity Hierarchy (parenting).
- Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
- As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
- Removes this entity from the the movement hierarchy, leaving it free to move independently.
- Evaluates a keyvalue/output on this entity.
<output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
- Fire the
OnUseroutputs; see User Inputs and Outputs.
- Same as a player invoking +use; may not do anything. Can also be invoked by creating an output that does not specify an input.
This input is not included in Valve's FGDs.
- Dispatches a special effect from the entity's origin. Removed and replaced entirely by the particle system since .
- Dispatches a response to the entity. See Response and Concept.
- Adds to the entity's list of response contexts. Format is
- Remove a context from this entity's list. The name should match the key of an existing context.
- Removes all contexts from this entity's list.
- Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
- Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console. Bug: In , the code is executed in the script scope of the entity that fires the output, not the one receiving the input.Warning: Never try to pass string parameters to a script function with this input. It will corrupt the VMF structure because of the nested quotation marks, which then must be removed manually with a text editor.
- Execute a VScript function in the scope of the receiving entity.
- Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
- Set this entity's angles.
- These outputs each fire in response to the firing of the like-numbered
FireUser4Input; see User Inputs and Outputs.
- This output fires when the entity is killed and removed from the game.