three.js, down to the metal.
ThreeRT is a native runtime for three.js: no browser between your scene and the GPU.
Website · Blog · Apps · Download · Docs · Discord · X
Take the browser out from under three.js, and three things open up.
- 45× smaller.
webgpu(macOS and Linux) runs three.js r187 and its ownWebGPURenderer, unchanged, on a nativenavigator.gpuover wgpu, with the same pixels as Chrome. A desktop app is 9.9 MB installed where its Electron build is 445 MB; a three.js wallpaper on Wayland uses 15.6 % CPU where Chromium uses 39.9 %, and none while a window covers it. - On a Sony PS3. On hardware with no WebGPU and no JIT, three.js r187's scene graph runs on QuickJS and a native renderer draws it on the RSX at 1920 × 1080, with a PocketJS interface in the same frame. Experimental, 16 to 30 fps: three.js on a Sony PS3.
- Ray-traced, 60 fps. On GPUs with ray-tracing hardware,
pathtraces every light in a three.js-style scene: shadows, bounce light, reflections and glowing surfaces, nothing baked, at 60 fps in production scenes.
Three + RT: Three, for the API you already know; RT, for ray tracing, real time, and the runtime under both.
Each way of running a three.js project keeps part of three.js and replaces the rest. In this repository, two renderers are selected at build time (node tools/build.ts --renderer path or --renderer webgpu). They share the native runtime (runtime/) with one-way dependencies (threert-path → threert-runtime ← threert-webgpu), enforced by CI (node tools/check-webgpu-gate.ts) so a webgpu build links no ray-tracing code at all. A third way, a native renderer for three.js's scene graph, runs on a PlayStation 3 and is built in PocketJS.
path |
webgpu (docs/RENDERING-METHODS.md) |
PlayStation 3 (experimental) | |
|---|---|---|---|
| Keeps of three.js | Its scene API, as @threert/scene (physical lighting units) |
three.js and its WebGPURenderer, unchanged, + TSL node materials |
The scene graph: objects, geometry, materials, lights |
| Replaces | The renderer, with a path tracer | The browser, with the native runtime | three.js's renderer, with a native one |
| Renderer | Rust + wgpu compute path tracer (hardware ray queries, OIDN, DLSS / MetalFX) | three.js r187 WebGPURenderer over native navigator.gpu (wgpu) |
C on the RSX, hand-written PBR, sky and unlit shaders; three.js r187 on QuickJS (no JIT) |
| GPU | Ray-tracing hardware (Apple M-series, RTX, RDNA2+) | Any GPU wgpu supports (Metal, Vulkan, D3D12) | The PlayStation 3's RSX, 1920 × 1080 |
| UI | The game HUD | PocketJS over the 3D frame | PocketJS in the same frame |
| Footprint | Full ThreeRT clients | Proven at 9.9 MB installed / 4.5 MB download (vs 445 / 170 MB Electron); also a Wayland wallpaper host (webgpu/wallpaper) |
16–30 fps in four demos, not yet profiled; in PocketJS, not built by tools/build.ts |
three.js's WebGPURenderer needs WebGPU, and it does its per-frame work in JavaScript, which runs several times slower without a JIT. A PlayStation 3 has neither WebGPU nor a JIT. There the scene code still imports three and builds a three.js scene graph; once a frame, a small renderer walks the graph, packs each object's transform and material into typed arrays, and hands them to native code that draws on the RSX. three.js's own renderer never runs, so what lives in it does not carry over: shadows, ShaderMaterial and TSL, three.js's post-processing. This sits between webgpu, which keeps all of three.js, and a port, which keeps only a game's rules. docs/RENDERING-METHODS.md has what it draws and what it costs.
On GPUs with ray-tracing hardware: the same scene file, run by both engines on the same Mac. three.js gets everything it has: shadow maps, image-based lighting and, on WebGPU, its own SSGI, SSR and TRAA.
| three.js r187 | ThreeRT |
|---|---|
![]() |
![]() |
![]() |
![]() |
| Bistro night, 1280 × 720 | Frame cost | Error against the reference (ΔE, lower is closer) |
|---|---|---|
| ThreeRT, live | 15.5 ms (60 fps) | 3.4 |
| three.js, WebGPU + SSGI + SSR + TRAA | 34.7 ms (29 fps) | 10.1 |
| three.js, WebGL tuned | 15.9 ms (60 fps) | 12.1 |
The reference is an unbiased offline render (4,096 samples per pixel, no denoiser). The method, every scene, and where three.js is ahead (it draws small scenes in about 1 ms) are in docs/COMPARE.md.
npm install
node tools/build.ts --renderer webgpu # the runtime and the webgpu renderer; no path-tracer code is linked
node tools/check-webgpu-gate.ts --render # dependency isolation, JS layering, binary size, a headless renderThe sample is plain three.js and TSL (webgpu/sample/scene.ts); the Omarchy wallpaper host is webgpu/wallpaper. How it is built and measured: docs/RENDERING-METHODS.md.
The PS3 runtime and its three.js renderer are built in PocketJS, with PSL1GHT, for a console with custom firmware. How it works and what it measured: three.js on a Sony PS3.
- Download ThreeRT for macOS (14 or later, Apple silicon), iPhone and iPad (iOS 17 or later), Steam Deck or Android. The client fetches a game's code and traces it on the device's own GPU.
- Open an example from the app's library or from threert.app, where ThreeRT apps and games are published.
- Write your own with the
threertcommand line that ships inside the Mac app:
threert create my-game
cd my-game
threert dev # bundles on save, serves every client on your network, prints a QR code for your phoneThe same address in any browser shows the game as three.js. The full walk-through is at threert.dev/docs.
To put ThreeRT inside a native app of your own, start from the native app templates: one repository with an app per platform in its own UI framework, macOS (SwiftUI) first. It is the recommended way to embed the engine, and it is set up for building with a coding agent:
- a SwiftUI app whose window is a live path-traced view (the engine's
LiveCoreon aCAMetalLayer, behind a small C ABI), with a sample scene that uses physics, glass, metal and moving lights; - the Claude Code or Codex already on the machine, in a side panel over the Agent Client Protocol: ask for a change and the agent edits the scene's TypeScript, which the view hot-reloads within a second;
- a code viewer with syntax highlighting that follows the agent's edits, a console, and a
scene check/scene shotcommand line the agent uses to verify its own work.
git clone --recursive https://github.com/threert/native-app-template my-app
cd my-app && bun tools/macos.ts --run| Package | What |
|---|---|
@threert/scene |
The three.js-style scene API: meshes, PBR materials, lights, glTF models, physics, volumes |
@threert/gameplay |
Games: state, transactional handlers, world handlers, frame scripts; input, a HUD and a channel to the app that runs the game; deterministic and replayable |
@threert/voxel |
Destructible voxel levels: explosions, cuts, and pieces that break off as rigid bodies |
npm install @threert/scene @threert/gameplaythreert dev bundles these for you. Install them from npm for types, tests, or a build pipeline of your own.
The engine is Rust and wgpu: hardware ray queries where the GPU has them (Metal, Vulkan), a software BVH where it does not. You need Rust, Node 24 and Bun.
npm install && bun scripts/setup.ts # assets/ -> the machine's shared asset store, then fetch what is missing
node tools/build-scenes.ts # scenes/*.ts + games -> out/bundles/<id>.js
bun renderer/build.ts # -> renderer/target/release/threert-render
renderer/target/release/threert-render play out/bundles/light-room.js # a game, in a window
renderer/target/release/threert-render render out/bundles/cornell-box.js -o out/cornell.png --spp 32 # a scene, to an image
node tools/three/open.ts scenes/bistro.ts # the same scene in three.js, in your browserIn the window: drag to orbit, right-drag to pan, wheel to zoom, WASD/QE to fly, R to reset, P for a snapshot.
play and live take --quality (auto, native, quality, balanced, performance, ultra-performance),
--reconstruction (builtin, builtin-upscaler, auto, an upscaler: fsr, metalfx, dlss; a joint denoiser:
metalfx-denoised, dlss-rr; or a list in order of preference) and --latency. FSR 1 also runs on WebGPU; DLSS requires an opt-in NVIDIA
SDK build; MetalFX requires supported Apple hardware. See
live rendering settings and the TypeScript API.
npm test && npm run typecheck && (cd renderer && cargo test --release) # scene API, gameplay, runtime and engine tests
npm run test:render # the render test suite, on the GPU| Demo | What | Run |
|---|---|---|
| Light Room | A small game: click coins, the floor, the balls, the crate and the walls | threert-render play out/bundles/light-room.js |
| Bistro | Amazon Lumberyard Bistro at night: a slice, the district, and a crowd of 150 walkers and 60 vans | games/bistro-slice, bistro-district, bistro-crowd |
| Zero-Day | Beeple's Zero-Day (Measure One), animated | games/zero-day |
| Tokyo | Shinjuku and Shiba from the PLATEAU city model, with a live time of day | games/tokyo, tools/tokyo |
| Voxel level | A destructible voxel city: explosions, cuts, whole buildings brought down in pieces, dust and smoke | games/voxel-level, docs/VOXEL.md |
| Showreel | Light and physics together: glowing balls down a staircase, a wrecking ball through a tower of glowing bricks, 400 lanterns | games/showreel |
| Directory | What |
|---|---|
renderer/ |
The engine: the Rust + wgpu path tracer, live viewport, denoiser, post, and an embedded QuickJS that runs scene code (threert-render); voxel-core and physics-core (Rapier) also build for wasm32 |
runtime/ |
The native runtime: the JavaScriptCore guest, web-platform globals (timers, fetch, WebSocket, storage, Canvas 2D), and the PocketJS host |
webgpu/ |
The webgpu renderer: navigator.gpu over wgpu, the sample, the headless webgpu-shot, and the Wayland wallpaper host |
packages/ |
@threert/scene, @threert/gameplay, @threert/voxel |
scenes/, games/ |
The reference catalog (Cornell box, material grid, Bistro, Zero-Day, …) and the playable content |
tests/ |
The render test suite (analytic and temporal checks) and the three.js compatibility set |
tools/ |
Bundling, benches and gates, the three.js comparison, the Tokyo pipeline |
compare/ |
Hello-world scenes side by side in three.js and ThreeRT |
ue5/ |
UE5 reference captures (Lumen and the Path Tracer): the ground truth the renderer is measured against |
site/ |
threert.dev: the landing page, the blog, Download and Docs (the apps themselves are on threert.app) |
- Getting started: the client, a first scene, the dev loop, packages
- Blog: engineering notes; the first is three.js on a Sony PS3
docs/RENDERING-METHODS.md: what each way of running keeps of three.js: thepathandwebgpurenderers, native scene-graph renderers, crate layout and size-gate rulesdocs/RUNTIME.md: how scene code runs in the engine: setup, handlers, world handlers, frame scripts, physicsdocs/MATERIAL_FUNCTIONS.md: a WGSL body on a material, run by the path tracer at every hitdocs/VOXEL.md: the voxel engine, measured on a destructible leveldocs/PORTS.md: a game written once for ThreeRT, and ports of it to devices the engine does not run ondocs/COMPARE.md: three.js at its strongest against ThreeRT, in frame rate and image qualitydocs/ARCHITECTURE.md,docs/REPORT.md: the serverless gameplay and rendering runtime the engine was built fordocs/ROADMAP.md: the goal, the plan, and what each step measured- Scene authoring skill: photo-referenced scenes with a coding agent
- Native app templates: the engine embedded in a native app (macOS/SwiftUI first), with a local coding agent that edits the scene live; start here to build an app on ThreeRT
Issues and pull requests are welcome. docs/WORKFLOW.md covers how work lands: one PR per item, the merge gate by tier, and CI. PRs are squash-merged.
The project started inside another repository and was extracted on 2026-11-10; PR numbers #1 to #139 in the docs, and the cloud/ and render-node/ directories some of them mention, refer to that one.
ThreeRT is under the MIT licence. The clients for macOS and iOS are free to use and closed source.
The assets are not in the repository; bun scripts/setup.ts fetches them. Third-party content keeps its own terms, listed in docs/ASSETS.md:
- Amazon Lumberyard Bistro: Amazon Lumberyard (2017). Zero-Day: Mike Winkelmann (Beeple) and Kate Anderson (2019). Both from NVIDIA's Open Research Content Archive (ORCA), CC BY 4.0, converted from FBX to glTF.
- Tokyo: the 3D city model is Project PLATEAU (MLIT Japan); elevation and aerial photos are GSI; roads and places are © OpenStreetMap contributors (ODbL). The compiler in
tools/cityis from jeantimex/tokyo (MIT). - Poly Haven and Quaternius assets are CC0; the glTF sample models are Khronos'.
three.js is an independent open-source project; ThreeRT is not affiliated with it.
A research project from MeshyAI




