Codectionary / Developer documentation / Luau

Atmosphere

Control atmospheric haze and distance appearance in a 3D scene.

Why use Atmosphere?

Atmosphere changes how light and color travel through the sky and distant scenery. It can help communicate weather or depth without placing many individual objects.

Try it in Roblox Studio

Put this Script in ServerScriptService and run in Studio. Reuse an existing Atmosphere child of Lighting if the place already has one.

Syntax

atmosphere.Density = 0.3

Examples

Atmosphere

Set a moderate haze in Lighting.

local lighting = game:GetService("Lighting")
local atmosphere = lighting:FindFirstChildOfClass("Atmosphere")
if not atmosphere then
    atmosphere = Instance.new("Atmosphere")
    atmosphere.Parent = lighting
end
atmosphere.Density = 0.3
atmosphere.Haze = 1
  1. FindFirstChildOfClass avoids adding a duplicate Atmosphere each time the script runs.
  2. Density and Haze affect the look of the air and distant geometry.
  3. The result is visual and depends on the rest of the Lighting setup; tune the values in Studio rather than assuming one preset fits every map.

Best practices

  • Keep one intentional Atmosphere configuration per place.
  • Check readability of game objects after changing haze.

Runtime & versions

Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.

Luau documentation

Specifications & further reading