Feature Library

Sky atmosphere: a physical sky with a cloud lid that opens

2.22 GPU · 0.25 CPU ms
A still of the Sky atmosphere: a physical sky with a cloud lid that opens demo
Still
The live demo starts when it’s in view.Drag the hour, pick a moment, open the clouds

The HaTac engine’s sky, lifted out whole in raw WebGPU.

The HaTac engine’s sky, lifted out whole in raw WebGPU: Rayleigh and Mie scattering and ozone, marched into cached transmittance, multiple-scattering and sky-view tables (Hillaire), an aerial-perspective volume that hazes every surface by its distance, a low fog layer, the sun’s light after the air and the moon’s at night, and a small prefiltered cube of the sky that every material can reflect. Over it a volumetric cloud lid, marched at a quarter of the screen with reprojected history, casts its shadows on the ground through a 64 × 64 map in the frame’s light buffer and lights shafts in the air below; an editable coverage field opens and closes gaps in it over seconds. A small host gives a plain WebGPU page the frame group, a reverse-Z camera, HDR and depth targets, stars and the moon’s disc, and a tone-mapped present, so the folder runs with no engine. The demo is a stylised valley scrubbed from dawn through golden hour to night.

What it costs a frame

2.22 ms
0.25 ms
GPU
2.22 ms
CPU, median
0.25 ms
CPU, 95th pct
0.47 ms
Draw calls
0
Weight
Heavy

Measured 25 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 158, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged GPU 2.02–4.05, CPU 0.24–0.56 ms). What ran: Alone: the sky and the cloud lid at golden hour, weather 0.8, looking up and out at 1920×1080; the lid opens over 6 s from the start, so the frames include the coverage field changing and the cloud shadow map rebuilding. Sky tables rebuild only when the sun moves (it does not here). Phones: tiers are being measured next.

How steadily it runs on RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900H · reference

Typical frame ?
16.88 ms
1% low ?
55 fps
Varies by ?
±0.49 ms
All metricsRTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900H · reference
p50p95p9916.05 ms18.09 ms +
How long each frame took. Most frames sit in the tall bars; a long tail to the right is hitching.

Frames run on a 60 Hz timer (a page demo), so most frames take about one tick, 16.7 ms: the spread around it is what matters.

Frames

Median (p50) ?
16.88 ms
p95 ?
17.75 ms
p99 ?
18.03 ms
Slowest ?
19.69 ms
Mean ?
16.90 ms
Standard deviation ?
0.49 ms
1% low ?
55 fps
0.1% low ?
51 fps
Hitches ?
0 of 600
Over budget ?
0 of 600

Main thread

Long tasks ?
0
Long frames ?
0
Event-loop delay ?
0.0 / 0.4 / 0.6 ms

Input

No input during this run.

Memory

JavaScript heap ?
37.8 → 34.4 MB
Growth ?
-3.36 MB

Browser

JavaScript a frame ?
0.38 ms
All tasks a frame ?
0.78 ms
Layout / style ?
0.00 / 0.00 ms
Main thread busy ?
5%

Garbage collection

Collections ?
5 (4 minor, 1 major)
Pauses ?
5.5 ms in all, longest 1.2

What it needs

Renders with
WebGPUNeeds WebGPU: current Chrome and Edge, Safari 26+, Firefox 141+ on Windows.
Your browser
Checking…Looking for WebGPU
Depends on
NothingNo other packages
With an agent
install("sky-atmosphere")Your coding agent reads its pitfalls and installs it through the library’s MCP server. Set it up

What it’s for

  1. The sky over a game world or a level: dawn to night from one time-of-day value, with haze that separates ridges
  2. A weather system: clear to overcast, with cloud shadows on the ground and shafts below a closing lid
  3. A moment in a game or a story: the clouds part over one place (a goal reached, a storm passing)
  4. Ambient and reflected light for every material from the sky itself (the prefiltered cube), not a fixed gradient
  5. A landscape or architecture hero that turns through the hours as people scroll or scrub
  6. A product shot outdoors whose light, reflections and haze follow the time of day

Pitfalls, in brief

  1. The demo needs WebGPU: the sky tables, the aerial volume, the reflection cube and the cloud shadow map are compute passes into storage textures and buffers, and there is no WebGL path.
  2. Write only the light header each frame.
  3. Keep the tables between frames, and hold a moving sun.
  4. A physical night is black.
  5. Shade your scene without fog: the haze (aerial perspective) and the fog layer are applied afterwards from the depth buffer.
11 more in brief
  1. Preserve signed azimuth for anything you add to the haze volume: mirroring a local medium along with the clear-air lookup paints a second plume on the other side of the sun (the engine found this with local smoke).
  2. Match table ends to texel centres and keep spectral transmission.
  3. The fog layer’s optical depth grows exponentially downward: the eye is clamped to 40 m below its base, or a camera under it reads infinite fog.
  4. Size the cloud field to the place people see.
  5. Keep the cloud history weight low while a gap moves; the module does (it drops history to 15% while the coverage changes) and fades history at nearly clear edges.
  6. Cloud history must follow the light.
  7. Jitter each cloud sample across its whole step.
  8. The single sheet (Low, one cloud sample) read one point of the noise, so a hole there opened a crisp, fully clear window through an otherwise solid lid (at night two glowing “eyes” with the moon’s halo in them).
  9. Give the clouds one clock. coverage.open and close take the same time you pass to render (seconds of your simulation, not the wall clock); under reduced motion hold that clock still, set the wind to 0 and open gaps over 0 seconds, or they never finish opening.
  10. Seen from below at a low angle, the lid reads as soft streaks and the far bank takes the sky’s colour (the clouds’ own aerial perspective): a closed lid at sunset looks like a dim, hazy sky, not a white ceiling.
  11. One host makes the frame group, its own HDR, depth and two more screen targets (about 30 bytes a pixel at 1×) and the clouds’ quarter-resolution history.
16 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From HaTac. Adapted from published work, named below.

Hannes Andersson: The HaTac engine’s atmosphere and cloud lid (built for his game and proven there), the library host and the demo’s valley.

Sébastien Hillaire, A Scalable and Production Ready Sky and Atmosphere Rendering Technique (2020): The scattering integrals, the multiple-scattering table, the sky-view table’s horizon-squeezed mapping and the aerial-perspective volume follow his model; the engine’s README links his reference implementation. Re-written, no code taken.

Eric Bruneton & Fabrice Neyret, Precomputed Atmospheric Scattering (2008): The transmittance table’s parametrisation (distance to the top against height).

Cornette & Shanks (1992): The Mie phase function.

Krzysztof Narkowicz, ACES Filmic Tone Mapping Curve (2016): The host’s present pass uses his fit.

skyatmospherephysical skyrayleighmieozoneaerial perspectivehazefog layervalley mistsunmoonstarsnight skytime of dayday cyclegolden hourdawncloudsvolumetric cloudscloud lidcloud shadowslight shaftsgod rays

Near it in the frame