Feature Library

Progressive path tracer with a sun slider

4.46 GPU · 0.12 CPU ms
A still of the Progressive path tracer with a sun slider demo
Still
The live demo starts when it’s in view.Drag the picture sideways or the sun along its arc (arrow keys too) · pick a view · watch the samples, then the rest

A WebGPU compute path tracer for rooms and buildings made of boxes and ellipsoids, lit by the real sun for any day, hour and latitude, a sky and lamps.

What it costs a frame

4.46 ms
0.12 ms
GPU
4.46 ms
CPU, median
0.12 ms
CPU, 95th pct
0.26 ms
Draw calls
0
Weight
Heavy

Measured 13 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged GPU 4.10–4.58, CPU 0.10–0.13 ms). What ran: Measured exercising itself: once the light has settled and the sun times are baked, the sun sweeps back and forth across the day every 12 s, so every frame shows live direct sun on baked light (a shadow ray a pixel, the composite and the denoiser) at render scale 0.6 of the stage. Settling after a change costs 4–6 ms a frame for a few seconds; resting costs nothing. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool4.460.120.26
apple · Apple A19 Proin a browser tab · 16 November 20268.320.240.74
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20268.060.170.28

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

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

What it’s for

  1. A room or a building lit by the real sun for any day and hour
  2. A hero render that settles and then costs nothing
  3. Daylight studies: where the sun falls and for how long
  4. A material or finish shown under true light
  5. A page section lit like a wall, its headings casting shadows
  6. A still that refines while the visitor reads

Pitfalls, in brief

  1. It rests only when you let it. needs() is false once the samples reach the goal and the picture is shown; stop encoding then (and stop the bake once bakePending() is false), or the GPU never sleeps.
  2. Never reset with soften(0) for an ordinary change: it throws the picture away and the next frame is one sample old. soften(1–3) keeps it as if a few samples old, so the change dissolves in; setSky, set and setScene do this for you with their k argument.
  3. The bake is only used while you pass the hour: setSky(sky, k, hour).
  4. Bake once the picture rests, not alongside it: sharing each frame halves how fast the picture settles.
  5. An interior is lit mostly by bounced light, which is exactly what the bake holds: at the source’s 40 samples a sun time it shows as blotches while you drag.
7 more in brief
  1. A view keeps 320 primitives, 40 groups and 8 lamps (LIMITS); the rest are dropped silently.
  2. Path-traced interiors are lit mostly by bounced light, which converges slowly: a few hundred samples still show grain.
  3. The cost is per pixel-sample (about 20 ns for this room on the reference laptop): budget it in pixel-samples a frame and adapt to the GPU time (SampleBudget), never a fixed samples-per-frame.
  4. The accumulation buffers are sized from the canvas’s CSS box times the scale when the target is made and on resize().
  5. Lamps light the scene only while their radiance (lampE) is above zero; the panels themselves are boxes that stay in the scene, dark by day.
  6. The lit wall’s mask is drawn from the DOM text where the browser laid it out: call setText after fonts load and again after the section resizes.
  7. Without WebGPU nothing here runs: draw a fallback (the demo’s line drawing uses rayHits and the same camera maths) and keep the numbers in the DOM.
12 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From HaTac. Fully custom code.

Mark Jarzynski & Marc Olano, Hash Functions for GPU Rendering (2020): The PCG hash behind every random number, the noise of the materials and the dither (it replaces the source’s sine hash in the display).

Holger Dammertz et al., Edge-Avoiding À-Trous Wavelet Transform for Fast Global Illumination Filtering (2010); Christoph Schied et al., Spatiotemporal Variance-Guided Filtering (2017): The denoiser: an à-trous filter on demodulated lighting, guided by normals, depth and a local variance.

Bruce Walter et al., Microfacet Models for Refraction through Rough Surfaces (2007): The GGX distribution, with Smith’s masking and Schlick’s Fresnel approximation (1994).

Tom Duff et al., Building an Orthonormal Basis, Revisited (JCGT 2017): The basis around a normal for sampling.

Martin Roberts, The Unreasonable Effectiveness of Quasirandom Sequences (2018): The R2 and Kronecker sequences for the first bounce, rotated per pixel (Cranley & Patterson 1976).

Zina Cigolle et al., A Survey of Efficient Representations for Independent Unit Vectors (JCGT 2014): Octahedral encoding of the normals in the G-buffer.

Khronos PBR Neutral tone mapper (Khronos Group, 2024): The display’s tone curve, written from its published specification.

Steven Worley, A Cellular Texture Basis Function (1996): The cellular noise in the charred timber and travertine.

Fritz Kasten, air mass formula (1965): How much air the sunlight crosses near the horizon: the sun’s colour and strength in sun.ts.

path tracingprogressive renderingaccumulationdenoisera-troussvgfsun positiondaylightinteriorarchitecturepbrggxnext-event estimationlow discrepancyreprojectionbaked lightlit walltext shadowscomputeraw webgpuwgslrest when stilltimestamp queriesno dependencies

Near it in the frame