SlashCo Wiki

Fog

Fog

Fog

SlashCo has a clientside fog system which dynamically changes the fog based on the player's environment and location.
Fog can be configured globally, for a specific team, or for an individual player using SlashCo.AddFog. Fog entries can be removed using SlashCo.RemoveFog.
The fog system uses SlashCo.FogType to determine which players an entry applies to.

Fog Types

There are three fog types:

When multiple fog entries apply to a player, the entry with the highest priority is used.

Dynamic Fog

The base fog distance is dynamically adjusted based on the player's surroundings.
There are three primary fog stages:

Outside:
When the player has visibility to the skybox, the fog allows a greater view distance.

Inside Building:
When the player is inside a building while the outside light is still reachable, the fog distance is reduced.

Underground:
When the player cannot see the skybox, such as inside a basement, the fog closes in further and significantly reduces the view distance.

The final fog distance is also always affected by the lighting at the player's position.

Fog Multipliers

A fog entry can specify a FogInfo.multiplier using SlashCo.AddFog. This multiplier is applied to the dynamically calculated fog start and end distances.
A multiplier greater than 1 increases the fog distance, while a multiplier less than 1 brings the fog closer.

Fog Colors

Fog entries can optionally modify the world fog color using:

Color scaling can additionally be controlled using:

The final color is calculated by multiplying each color component by its corresponding color scale.

Spectators

Spectators inherit the fog settings of the player they are currently spectating.
If a spectator is not spectating a valid player, they receive a fog multiplier of 100, effectively giving them very little fog.

Disabling Global Fog

When global fog is disabled through SlashCo.IsGlobalFogDisabled, the normal dynamic fog distances are replaced with extremely large distances, effectively disabling the environmental fog.

Example

SlashCo.AddFog({ name = "Example", fogType = SlashCo.FogType.GLOBAL, priority = 10, multiplier = 0.5, worldColorR = 100, worldColorG = 120, worldColorB = 140 })