Skip to content
Proyectos

Acerca de

El runtime nativo de three.js, llevado hasta el metal. Es 45 veces más pequeño que Electron, funciona en una Sony PS3 y permite realizar path tracing a 60 fps en GPU con trazado de rayos.

Diseño y multimedia

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
+2
in 7 days
+64
in 15 days
+161
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

ThreeRT

ThreeRT

three.js, down to the metal.

ThreeRT is a native runtime for three.js: no browser between your scene and the GPU.

CI @threert/scene on npm MIT licence Clients for macOS, iOS, Steam Deck and Android Discord

Website · Blog · Apps · Download · Docs · Discord · X

three.js, down to the metal: 45 times smaller than Electron, on a Sony PS3, ray-traced at 60 fps

Down to the metal

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 own WebGPURenderer, unchanged, on a native navigator.gpu over 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, path traces 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.

Renderers: what each keeps of three.js

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

A native renderer for the scene graph

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.

Ray-traced: against three.js at full power

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
Amazon Lumberyard Bistro at night in three.js The same frame in ThreeRT
Beeple's Zero-Day in three.js The same frame in 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.

Get started

Run three.js natively (webgpu, macOS and Linux)

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 render

The 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.

three.js on a Sony PS3

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.

Play and make games (path)

  1. 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.
  2. Open an example from the app's library or from threert.app, where ThreeRT apps and games are published.
  3. Write your own with the threert command 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 phone

The same address in any browser shows the game as three.js. The full walk-through is at threert.dev/docs.

Build your own app on the engine

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 LiveCore on a CAMetalLayer, 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 shot command 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

Packages

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/gameplay

threert dev bundles these for you. Install them from npm for types, tests, or a build pipeline of your own.

Build the engine from source

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 browser

In 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

Demos in this repository

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

Repository layout

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)

Documentation

Contributing

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.

Licence and credits

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/city is 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

Explorar proyectos relacionados

Cargando…