The live demo starts when it’s in view.Compare plain and corrected mipmaps · change distance or cutoff · Near view and Far view keep both cameras matched
Build explicit RGBA mipmaps for alpha-tested atlases so thin leaves, stems and fence wire survive minification.
Each cell targets its own base coverage; alpha-weighted RGB avoids transparent-colour fringes, and an uncorrected pyramid prevents opacity boosts from accumulating. Pure CPU preprocessing with no renderer dependency.
What it costs a frame
GPU
0.15 ms
CPU
0.18 ms
02468101216.7 ms
GPU
0.15 ms
CPU, median
0.18 ms
CPU, 95th pct
0.30 ms
Draw calls
4
Weight
Light
Measured 19 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 0.06–0.18, CPU 0.17–0.20 ms). What ran: Two synchronized views of one code-generated 256×256 RGBA atlas on identical quads. Left uses an uncorrected box-filter chain, right uses per-cell coverage correction; both use alpha-weighted RGB, alpha test and trilinear filtering. Mips build on load/cutoff edits, not per frame. No automatic motion, external textures, blending, alpha-to-coverage or lighting. 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 ?
3.10 ms
1% low ?
149 fps
Varies by ?
±1.21 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 back to back, each starting once the GPU has finished the last, so frame times show the work itself. They have a floor of about 4–5 ms from the browser’s own scheduling: GPU and CPU ms stay the measure of cost.
Frames
Median (p50) ?
3.10 ms
p95 ?
5.26 ms
p99 ?
6.14 ms
Slowest ?
7.32 ms
Mean ?
3.25 ms
Standard deviation ?
1.21 ms
1% low ?
149 fps
0.1% low ?
137 fps
Hitches ?
4 of 600
Over budget ?
0 of 600
Main thread
Long tasks ?
0
Long frames ?
0
Event-loop delay ?
0.0 / 0.3 / 0.3 ms
Input
No input during this run.
Memory
JavaScript heap ?
41.4 → 42.7 MB
Growth ?
+1.33 MB
Browser
JavaScript a frame ?
0.01 ms
All tasks a frame ?
0.37 ms
Layout / style ?
0.00 / 0.00 ms
Main thread busy ?
11%
Garbage collection
Collections ?
5 (5 minor, 0 major)
Pauses ?
1.6 ms in all, longest 0.3
What it needs
Renders with
WebGPU or WebGLWebGPU where there is one, WebGL2 where there is not.
Your browser
Runs hereNo WebGPU needed
Depends on
three.js 0.187.0No other packages
With an agent
install("alpha-mips")Your coding agent reads its pitfalls and installs it through the library’s MCP server. Set it up
What it’s for
Keep thin alpha-tested foliage visible at a distance
Preserve sparse fence wire through mip reduction
Build per-cell atlas mipmaps without loading source art
Avoid transparent RGB fringes and cumulative opacity inflation
Pitfalls, in brief
Input is tightly packed unpremultiplied RGBA8 in a Uint8Array, with positive power-of-two width/height and square power-of-two cells fitting both dimensions.
cutoff is a byte threshold from 1 to 255, not a normalized 0–1 value.
Coverage is a heuristic, not exact area conservation: rounded texel counts, tied alpha values and the 1.5× cutoff headroom can overshoot.
Cells remain independent only while each is at least one mip texel.
Never feed a corrected mip back into the next average.
5 more in brief
RGB is alpha-weighted in the supplied byte space, not automatically linearized.
The returned array includes the original base object at level zero; its bytes are not modified.
Upload the whole explicit chain including level zero, set generateMipmaps=false and a mipmapped minification filter.
This is for alpha-tested cutouts, not ordinary alpha blending.
Build on load or asset/cutoff edits, never each frame.
10 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: Source per-cell coverage mip builder, uncorrected pyramid and atlas integration.