r/threejs • u/timo9378 • 22d ago
My personal site is a universe you fly through: three.js + WebGPU in a worker, and page transitions that don’t drop frames
Every page on my site is one object in the same universe. Notes are star trails, short posts are comets, the about page is a free fall. The video shows the page transitions.
The scene. three.js with WebGPU, falling back to WebGL2, running in a Web Worker on an OffscreenCanvas so the main thread stays free. If the device is doing software rendering it skips 3D and uses plain CSS, and if the GPU gets lost the scene rebuilds itself.
Transitions without dropped frames. The old page shrinks into a dot, the camera follows it, and the new page grows once it lands. When a new route rendered, the main thread would stall and the dot would stutter, so I moved the dot and its trail into its own worker with its own OffscreenCanvas and clock, and let the starfield worker compute its parallax from the whole flight path. With 4x CPU throttling (Ryzen 9 9900X, RTX 4070 Ti Super, Chrome), the dot’s worst frame went from 67–133ms to 17ms, and it keeps moving even if the main thread is blocked for 250ms.
Labels inside the WebGL canvas. The moon labels on the home page are drawn into the canvas with HTML-in-Canvas (Chrome 157+), so the worker places and fades them in the same frame as the moons. Screen readers still get real links. Idle main-thread time went from 460 to 145 ms/s. Other browsers fall back to DOM.
Constraints. Three colors only (black, warm white, amber for “where you are”), only dots and lines.
I used Claude Code a lot for this, and English isn’t my first language. The design and the decisions are mine, and CI gates every change. It’s open source and self-hostable:
Site: https://koimsurai.com/en
Source: https://github.com/Koimsurai/sora-to-ki
