Skip to content

Fog

Class ยท server and client scripts

Fog controls atmospheric distance fog that blends distant objects toward a color. Access it through World.Fog.

Example

-- Server script.
World.Fog.Mode = "Linear"
World.Fog.Start = 40
World.Fog.End = 220
World.Fog.Color = Color.new(0.6, 0.7, 0.8)

Color

Property
Color: Color

Color is the color that objects blend into with distance. The fog is lit by the same sun and sky as the ground; the sky itself is not fogged.

Default Color.new(0.5, 0.5, 0.5)

Mode

Property
Mode: FogMode

Mode sets how fog thickens with distance, using one of these FogMode strings:

  • "Linear": from none at Start to solid at End.
  • "Exponential": thickens near the camera by Density.
  • "ExponentialSquared": thickens by Density with the nearest area clearer.

Default "ExponentialSquared"

Density

Property
Density: number

Density is how thick the fog is in "Exponential" and "ExponentialSquared" modes, from 0 to 1.

Default 0.01

Start

Property
Start: number

Start is the distance from the camera, in units, where "Linear" fog begins.

Default 0

End

Property
End: number

End is the distance from the camera, in units, where "Linear" fog hides objects fully.

Default 300