Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

fog

Scene-wide exponential height fog with directional in-scattering.

local fog = require("@builtin::systems.atmosphere.fog")

fog.set({ density = 0.03, heightFalloff = 0.12, heightRef = 0, inscatter = 2.5 })
fog.get()       --> the settings in force
fog.active()    --> is the fog pass running
fog.clear()     --> fog off, settings kept for the next set()

set takes any subset — omitted fields keep their current value, so adjusting one knob does not mean restating the rest. A density of 0 turns fog off and releases the render pass rather than running it at zero strength.

sunDirection / sunIntensity follow the scene's sun unless the call pins them, which is what keeps in-scattering pointing the right way under a day/night cycle.

For fog that a scene should simply have, author the HeightFog component instead — it carries the same settings, persists with the scene, and edits live in the inspector. This module is for code that changes fog at runtime: weather, cutscenes, a quality slider.

The full description of what each knob does and how the pass works is in the package readme: guides { path = "systems/atmosphere" }.