atmosphere.package
This package holds more than this page lists. See all of its files in its world.
README.md
HeightFog
The scene's atmosphere, as a component. Add it to an entity and the scene gets exponential height fog: density thins with altitude, so a valley pools fog while a hilltop above it clears, and the medium brightens toward the sun.
local id = entity.spawn("atmosphere").id
entity(id).component.add("HeightFog", {
density = 0.03,
heightFalloff = 0.12,
heightRef = 0,
inscatter = 2.5,
})
Every field is live — editing one in the inspector moves the fog on the next
frame, and the values persist with the scene. Setting density to 0 turns fog
off while keeping the rest of the settings authored; removing the last one
in the scene clears it entirely.
| field | effect |
|---|---|
color | The colour a fully fogged surface reaches, and so the colour of the far field. Defaults to (0.62, 0.68, 0.78), a daylight grey. |
density | Extinction per world unit at heightRef. 0 is no fog. |
heightFalloff | Thinning with altitude, per world unit. 0 gives a distance-only fog. |
heightRef | The world-space Y that density describes. |
start | Distance before fog accumulates, so near geometry stays readable. |
inscatter | How far the medium goes toward sunColor at the centre of the sun, in [0, 1]. 0 makes fog directionless. |
sunColor | The colour fog takes on when looking into the sun. |
inscatterAnisotropy | Forward-scattering bias in [0, 0.95). Higher tightens the lobe. |
The sun the lobe points at is the scene's own, re-read each frame, so fog follows a day/night cycle without being told.
Code that changes fog at runtime can drive the same settings through
@builtin::systems.atmosphere.fog instead.