Env fog controller: Difference between revisions
m (→Keyvalues) |
m (confirmed switching fog controllers works in gmod) |
||
Line 10: | Line 10: | ||
In [[Left 4 Dead]] and [[Left 4 Dead 2]], multiple env_fog_controllers may be used in conjunction with [[fog_volume|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 fog_controller, or if no fog_volume is used in a region. | In [[Left 4 Dead]] and [[Left 4 Dead 2]], multiple env_fog_controllers may be used in conjunction with [[fog_volume|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 fog_controller, or if no fog_volume is used in a region. | ||
In {{HL2}} mods/games using Source 2007 and Source 2013 you can create client-side fog changing functionality in a multiplayer game using [[trigger_multiple]]. Have at least 2 env_fog_controllers with different fog settings and one checked with the '''Master flag'''(which will be the default fog). Use OnStartTouch > !activator > '''SetFogController''' > [name of env_fog_controller entity]. The input will appear as red, but it still works. Use OnEndTouch() to change the fog back. '''Interpolate Time''' affects the transition of the fog color and fog distance parameters between controllers, however '''Far Z Clip Plane''' as well as '''Fog Max Density''' change instantaneously(which can appear jarring). Confirmed in [[Counter-Strike: Source]]. | In {{HL2}} mods/games using Source 2007 and Source 2013 you can create client-side fog changing functionality in a multiplayer game using [[trigger_multiple]]. Have at least 2 env_fog_controllers with different fog settings and one checked with the '''Master flag'''(which will be the default fog). Use OnStartTouch > !activator > '''SetFogController''' > [name of env_fog_controller entity]. The input will appear as red, but it still works. Use OnEndTouch() to change the fog back. '''Interpolate Time''' affects the transition of the fog color and fog distance parameters between controllers, however '''Far Z Clip Plane''' as well as '''Fog Max Density''' change instantaneously(which can appear jarring). Confirmed in [[Counter-Strike: Source]] and [[Garry's Mod]]. | ||
{{note|The [[3D Skybox]] fog levels set by the [[sky_camera]] parameters should correspond to your [[env_fog_controller]] settings.}} | {{note|The [[3D Skybox]] fog levels set by the [[sky_camera]] parameters should correspond to your [[env_fog_controller]] settings.}} |
Revision as of 10:43, 18 February 2018
Entity description

It determines the density of aerial fog for the whole map.
In Left 4 Dead and Left 4 Dead 2, 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 fog_controller, or if no fog_volume is used in a region.
In mods/games using Source 2007 and Source 2013 you can create client-side fog changing functionality in a multiplayer game using trigger_multiple. Have at least 2 env_fog_controllers with different fog settings and one checked with the Master flag(which will be the default fog). Use OnStartTouch > !activator > SetFogController > [name of env_fog_controller entity]. The input will appear as red, but it still works. Use OnEndTouch() to change the fog back. Interpolate Time affects the transition of the fog color and fog distance parameters between controllers, however Far Z Clip Plane as well as Fog Max Density change instantaneously(which can appear jarring). Confirmed in Counter-Strike: Source and Garry's Mod.




Adding fog (to represent haze, mist, diffuse smoke or dust) to the atmosphere has important implications for 'realistic' Lighting. 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 Lightbeams 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.
Keyvalues
- fogenable <boolean>
- Enable fog on map load.
Note:The default for this entity is False. In order to actually have fog, you will need to change this.
- fogstart <float>
- How far from the viewer the fog should start.
- fogend <float>
- How far from the viewer the scene should be completely fogged.
- fogmaxdensity <float>
- Fog Max Density [0..1]
- farz <integer>
- Far Z Clip Plane
- This setting is used for optimizing your map. Anything beyond this distance (in world units) will not be rendered. It is recommended to keep this number higher then your fogend value and ensure fogmaxdensity is set to 1.
- fogcolor ⇆#000000rgb(0,0,0)⇆
- Primary Fog Color.
- fogblend <boolean>
- This will enable blending between fogcolor and fogcolor2, based on the direction the player is looking. If the player's viewpoint is equal to the fogdir vector, the fog will be drawn with fogcolor2 (red); if facing in the opposite direction, the fog will be drawn with fogcolor (blue). If facing perpendicular to the fogblend axis, the fog will be a 50/50 blend of fogcolor and fogcolor2 (purple).
- This can be used to approximate the effect of light diffusing through the fog, but since the fogblend effect is applied for the entire rendered scene, it is best to keep the two colors relatively close to make the blending less obvious.
- For example, sunlight with a Yaw of 45 degrees and a Pitch of -45 degrees could be enhanced using a fogdir of "-1 -1 1", a fogcolor of "120 110 100" and a fogcolor2 of "80 70 60".
- fogcolor2 ⇆#000000rgb(0,0,0)⇆
- Secondary Fog Color.
- fogdir <vector>
- Primary Fog Direction
- A vector (given by three space-separated numbers X Y Z) which points from the secondary fogcolor2 towards the primary fogcolor.
- use_angles <boolean>
- Use Angles for Fog Dir
- Use angles instead of fogdir for the fogblend-axis.
- Pitch Yaw Roll (Y Z X) (angles) <QAngle>
- 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.
- Minimum / Maximum DX Level (mindxlevel / maxdxlevel) <integer choices> (removed since
)
- The entity will not exist if the engine is running outside the given range of DirectX Versions.
Choices Warning:If these are used, the object may break when the user switches their DirectX settings.[missing string]
- 0 - Default (no bounding)
- 60 - DirectX 6 (!FGD for mindxlevel)
- 70 - DirectX 7
- 80 - DirectX 8 (GeForce4 Ti & FX 5000 series)
- 81 - DirectX 8.1 (GeForce FX 5800, 5900 & Radeon 8500/9100 and 9000/9200)
- 90 - DirectX 9 Shader Model 2
- 92 - OpenGL аналогичен DirectX 9 Shader Model 2 (using ToGL;
only) !FGD
- 95 - DirectX 9 Shader Model 3 (in all games since
)
- 98 - DirectX 9 Shader Model 3 on Xbox 360 (
only) !FGD
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentname
ortarget
).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
Flags
- 1 : Master (Has priority if multiple env_fog_controllers exist)
Inputs
- SetStartDist <float>
- Set the fog start distance.
- SetEndDist <float>
- Set the fog end distance.
- TurnOn
- Turn the fog on.
- TurnOff
- Turn the fog off.
- SetColor ⇆#000000rgb(0,0,0)⇆
- Set the primary fog color.
- SetColorSecondary ⇆#000000rgb(0,0,0)⇆
- Set the secondary fog color.
- SetFarZ <integer>
- Set the far clip plane distance.
- SetAngles <angle>
- Set the angles to use for the secondary fog direction.
- SetColorLerpTo ⇆#000000rgb(0,0,0)⇆ (in all games since
)
- SetColorLerpTo ⇆#000000rgb(0,0,0)⇆ (in all games since
- Set the primary fog color.
- SetColorSecondaryLerpTo ⇆#000000rgb(0,0,0)⇆ (in all games since
)
- SetColorSecondaryLerpTo ⇆#000000rgb(0,0,0)⇆ (in all games since
- Set the secondary fog color.
- StartFogTransition (in all games since
)
- StartFogTransition (in all games since
- Start fog transition.
- SetFogController <targetname>
- Set the active fog controller.
Tip:This input should be used if fog_volume is not a valid entity. You can use this input by creating a trigger_multiple and setting its input to: (OnStartTouch > !activator > SetFogController > *Controller Name*)
Note:This input will also show up as red (invalid) but it will still work. If done correctly the Hammer Check For Problems Dialog should have no errors.
Outputs
Fog Technique
Source 2007 fog seems to be implemented based on a plane based fog technique versus a more modern radially fog technique. As a result the viewer will be able to see further into the fog along the edges. Furthermore, the fog is rotation dependent. Something that appears under fog at one view may change if the player rotates slightly.