Temporal upscale: draw fewer pixels, rebuild them from earlier frames
3.75 GPU · 0.38 CPU ms
Still
The live demo starts when it’s in view.Drag the line and the magnifier; pick fixed or dynamic; drag the view to turn it
Temporal reconstruction and GPU-driven dynamic resolution in raw WebGPU, from the owner’s HaTac engine.
The scene is drawn at a fraction of the screen with a 16-sample Halton jitter; one WGSL pass rebuilds it at full size from a pair of native-resolution colour and depth histories, reprojected through depth and the camera with each moving surface’s own motion added, rejected where reverse-Z depth says the surface was hidden (checking the old reconstruction footprint so thin rails and wires keep their history), and bounded by the 3×3 neighbourhood’s range and spread. A timestamp controller reads the GPU’s own frame times and steps the scale down quickly and up slowly to hold a frame rate. On the reference laptop a busy 1080p frame went from 5.3 ms drawn natively to 2.8 ms at 67% and 1.8 ms at half, with the resolve itself about 0.3 ms; against a supersampled reference its error at half scale (8.07) beat a bilinear stretch at the same scale (8.74), and at 75% (6.53) came close to native TAA (5.26). UI is drawn afterwards at the display’s own pixels. No three.js, no dependencies.
What it costs a frame
GPU
3.75 ms
CPU
0.38 ms
02468101216.7 ms
GPU
3.75 ms
CPU, median
0.38 ms
CPU, 95th pct
0.71 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.44–3.94, CPU 0.29–0.38 ms). What ran: Alone: the test card (a turning star, a sliding grating, thin rods) drawn at 67% of the stage and resolved to full size: one scene pass with motion, the temporal resolve, and the tone pass. No comparison drawn. GPU time from the scene pass to the canvas by timestamp queries. 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.85 ms
1% low ?
55 fps
Varies by ?
±0.47 ms
All metricsRTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900H · referenceHow 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.85 ms
p95 ?
17.70 ms
p99 ?
18.02 ms
Slowest ?
18.42 ms
Mean ?
16.87 ms
Standard deviation ?
0.47 ms
1% low ?
55 fps
0.1% low ?
54 fps
Hitches ?
0 of 600
Over budget ?
0 of 600
Main thread
Long tasks ?
0
Long frames ?
0
Event-loop delay ?
0.0 / 0.6 / 0.7 ms
Input
No input during this run.
Memory
JavaScript heap ?
37.1 → 33.8 MB
Growth ?
-3.36 MB
Browser
JavaScript a frame ?
0.41 ms
All tasks a frame ?
0.89 ms
Layout / style ?
0.02 / 0.00 ms
Main thread busy ?
5%
Garbage collection
Collections ?
4 (3 minor, 1 major)
Pauses ?
8.6 ms in all, longest 1.7
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("temporal-upscale")Your coding agent reads its pitfalls and installs it through the library’s MCP server. Set it up
What it’s for
A WebGPU game or world that must hold 60 fps on laptops: draw at 60–75% and keep the picture close to native
A heavy pixel shader (many lights, volumetrics, ray marching) whose cost falls with the pixels drawn
A self-tuning quality setting that lowers resolution only while the GPU is behind
Steadier thin detail (fences, cables, grass, lattice) than a plain stretch or no anti-aliasing at full size
Native TAA: every pixel drawn, jittered and blended, for smooth edges without MSAA
A comparison or settings page that shows players what each scale costs and looks like
Pitfalls, in brief
The demo needs WebGPU: the scene, its motion target and the resolve are WGSL render passes on float targets, and dynamic mode reads WebGPU timestamp queries.
Give every animated surface its motion: write last frame’s world position minus this one’s (xyz) and the fragment’s reverse-Z depth (w) into an rgba16float target at the scene size, from the pose at the previous and the current time.
Jitter only the main scene’s projection, and give the resolve the jittered inverse for this frame and the unjittered previous view-projection for the history: the history is addressed in display pixels.
Draw UI, labels and text after the resolve, at the output size, single-sampled and unjittered.
Feed the controller fresh timestamps only: each GPU reading once (a new object each time, as createFrameTimer gives), never the same delayed read-back counted once per animation frame, or it reacts to load that has already passed.
9 more in brief
Keep the swap chain’s size apart from the scene’s.
Include the camera’s own displacement: the scene is drawn camera-relative, so the previous matrix must be made relative to this frame’s eye (TemporalCamera.prepare does it).
Depth must be reverse-Z (near 1, far 0, cleared to 0, compare greater) with TEXTURE_BINDING, and the sky at depth 0: the resolve rejects history by depth and reprojects the sky by rotation alone.
Drop the history on a cut: call camera.reset() for a scripted cut, a teleport or any discontinuous change to the world.
Tone-map, dither and grade after the resolve, never before: the history is linear HDR.
Only pixel work scales: shadow maps, lookup tables, vertex work and the CPU’s draws cost the same at every scale.
Memory: the two native colour and depth pairs take 24 bytes a display pixel (47.5 MiB at 1080p), and the motion target 8 bytes a scene pixel.
A foreground billboard or a translucent layer has one motion and one depth a pixel: particles pass their own (particleMotion, with a fresh sample for births) or they trail.
In the demo the lamps light every pixel without culling, on purpose: they are its stand-in for a heavy scene so that dynamic mode has something to hold.
14 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.
Hannes Andersson: The HaTac engine’s temporal reconstruction, its controller, tests and measurements; the demo written for the library.
Ambient occlusion (GTAO from the frame’s own depth), bloom that only takes light brighter than lit white, specular anti-aliasing in every lit material and a…