Skip to content

The native runtime for three.js: three.js, down to the metal. 45× smaller than Electron, on a Sony PS3, and path-traced at 60 fps on ray-tracing GPUs.

docs(blog): Running Vanilla Three.js r187 at 1080p on a 2006 PlayStation 3 (#308)

Evan (Yifeng) Wangbb45880ad179
diff --git a/site/blog/index.html b/site/blog/index.html
index 5e5420e..33a773b 100644
--- a/site/blog/index.html
+++ b/site/blog/index.html
@@ -52,11 +52,11 @@
<div class="wrap posts">
<a class="post" href="ps3/">
- <span class="pic"><img src="../media/ps3/showroom-800.webp" width="800" height="450" alt="three.js objects on a Sony PS3, under a PocketJS overlay"></span>
+ <span class="pic"><img src="../media/ps3/showroom-800.webp" width="800" height="450" alt="Three.js r187 on a PlayStation 3: a gold torus knot over a mirrored floor, under a PocketJS HUD"></span>
<span class="t">
- <small>December 3, 2026 · 14 min</small>
- <b>three.js on a Sony PS3</b>
- <span>A WebGL developer’s tour of the RSX: two memories, a command FIFO you write yourself, fragment uniforms that live inside the program, and how a three.js r187 scene reached it at 1920 × 1080.</span>
+ <small>December 3, 2026 · 20 min</small>
+ <b>Running Vanilla Three.js r187 at 1080p on a 2006 PlayStation 3</b>
+ <span>A WebGL developer’s tour of the PS3 RSX GPU, raw NV40 shader assembly, hardware-stenciled planar reflections, and why ThreeRT is a runtime—not just a renderer.</span>
<em>Read the post →</em>
</span>
</a>
diff --git a/site/blog/ps3/index.html b/site/blog/ps3/index.html
index 08fd5af..594fbbd 100644
--- a/site/blog/ps3/index.html
+++ b/site/blog/ps3/index.html
@@ -3,14 +3,14 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
-<title>three.js on a Sony PS3 — ThreeRT Blog</title>
-<meta name="description" content="A WebGL developer’s tour of the Sony PS3’s RSX: two memories, a command FIFO you write yourself, fragment uniforms inside the program, and how a three.js r187 scene reached it at 1920 × 1080.">
+<title>Running Vanilla Three.js r187 at 1080p on a 2006 PlayStation 3 — ThreeRT Blog</title>
+<meta name="description" content="A WebGL developer’s tour of the PS3 RSX GPU, raw NV40 shader assembly, hardware-stenciled planar reflections, and why ThreeRT is a runtime, not just a renderer.">
<link rel="canonical" href="https://threert.dev/blog/ps3/">
<meta name="theme-color" content="#060709">
<meta property="og:site_name" content="ThreeRT">
<meta property="og:type" content="article">
-<meta property="og:title" content="three.js on a Sony PS3 — ThreeRT Blog">
-<meta property="og:description" content="A WebGL developer’s tour of the Sony PS3’s RSX: two memories, a command FIFO you write yourself, fragment uniforms inside the program, and how a three.js r187 scene reached it at 1920 × 1080.">
+<meta property="og:title" content="Running Vanilla Three.js r187 at 1080p on a 2006 PlayStation 3 — ThreeRT Blog">
+<meta property="og:description" content="A WebGL developer’s tour of the PS3 RSX GPU, raw NV40 shader assembly, hardware-stenciled planar reflections, and why ThreeRT is a runtime, not just a renderer.">
<meta property="og:url" content="https://threert.dev/blog/ps3/">
<meta property="og:image" content="https://threert.dev/media/ps3/og.jpg">
<meta property="og:image:width" content="1200">
@@ -38,10 +38,33 @@
.prose li b { color: var(--bone); }
.prose .code { margin-top: 12px; font-size: 12px; line-height: 1.7; overflow-x: auto; }
.prose .acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
- .fig { margin-top: 24px; }
+ .fig { margin: 24px 0 0; }
.fig img { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line); background: #000; }
.fig figcaption, .dg figcaption { margin-top: 12px; font-size: 13.5px; line-height: 1.5; color: var(--mute); max-width: 80ch; }
- .post-head h1 { max-width: 18ch; }
+ .post-head h1 { max-width: 21ch; font-size: clamp(34px, 4.3vw, 60px); line-height: 1.02; }
+ .post-head .lede { max-width: 64ch; }
+ .intro .beat { font: 620 clamp(22px, 2.2vw, 28px)/1.2 var(--font-sans); letter-spacing: -0.03em; color: var(--bone); margin-top: 22px; }
+ .prose ol:not(.steps2) { margin: 16px 0 0; padding-left: 22px; color: var(--bone-2); display: grid; gap: 10px; max-width: 70ch; line-height: 1.6; }
+ .prose ol li::marker { color: var(--mute); font-family: var(--font-mono); font-size: 13px; }
+ .prose ol b { color: var(--bone); }
+ .prose em { color: var(--bone); }
+ .prose p.fine { font-size: 14px; color: var(--mute); }
+
+ /* Comparison tables. */
+ .tbl { margin-top: 22px; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--ink-1); }
+ .tbl table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.45; min-width: 620px; }
+ .tbl th, .tbl td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); color: var(--bone-2); }
+ .tbl tr:last-child th, .tbl tr:last-child td { border-bottom: 0; }
+ .tbl thead th { font: 500 11.5px/1.4 var(--font-mono); color: var(--mute); background: #0e1016; }
+ .tbl tbody th { font-weight: 600; color: var(--bone); white-space: nowrap; }
+ .tbl td.hot, .tbl tr.hot td, .tbl tr.hot th { background: color-mix(in srgb, var(--c-ps) 9%, transparent); color: var(--bone); }
+ .tbl b { color: var(--bone); }
+ .tbl small { display: block; margin-top: 2px; font: 500 11px var(--font-mono); color: var(--mute); }
+ .tbl code { font-size: .92em; }
+
+ /* An aside that names the idea. */
+ .aha { margin-top: 20px; padding: 16px 18px 16px 20px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--ember) 45%, transparent); background: color-mix(in srgb, var(--ember) 8%, var(--ink-1)); color: var(--bone-2); font-size: 15px; line-height: 1.6; max-width: 76ch; box-shadow: inset 3px 0 0 color-mix(in srgb, var(--ember) 80%, transparent); }
+ .aha b { color: var(--bone); }
.intro { margin-top: 36px; }
.intro p { font-size: 17.5px; line-height: 1.6; color: var(--bone); max-width: 66ch; }
.intro p + p { color: var(--bone-2); font-size: 16px; }
@@ -107,7 +130,8 @@
.steps2 { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: s; }
.steps2 li { counter-increment: s; position: relative; padding: 10px 12px 10px 40px; border-radius: 10px; border: 1px solid var(--line); background: #10131a; display: grid; gap: 4px; font-size: 13.5px; color: var(--bone); }
.steps2 li::before { content: counter(s); position: absolute; left: 12px; top: 10px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font: 600 11px var(--font-mono); color: #111; background: var(--tungsten); }
- .steps2 code { font-size: 11px; color: var(--bone-2); background: none; padding: 0; overflow-wrap: anywhere; }
+ .steps2 li > * { min-width: 0; }
+ .steps2 code { font-size: 11px; color: var(--bone-2); background: none; border: 0; padding: 0; white-space: normal; overflow-wrap: anywhere; }
/* One frame, lane by lane. */
.lanes { display: grid; gap: 10px; }
@@ -149,90 +173,57 @@
<header class="page-head post-head">
<div class="wrap">
<span class="eyebrow">Blog · December 3, 2026</span>
- <h1 class="h-1">three.js on a Sony PS3.<br><span class="mute">A WebGL developer’s tour of the RSX.</span></h1>
- <p class="lede">three.js now draws on a 2006 Sony PlayStation 3: a scene written against the <code>three</code> package from npm, lit with physically based materials and a planar mirror, at 1920 × 1080, with a PocketJS interface in the same frame. The PS3 has no WebGPU and no JIT, and three.js has never had a renderer for its GPU.</p>
+ <h1 class="h-1">Running Vanilla Three.js r187 at 1080p on a 2006 PlayStation 3</h1>
+ <p class="lede">A WebGL developer’s tour of the PS3 RSX GPU, raw NV40 shader assembly, hardware-stenciled planar reflections, and why ThreeRT is a runtime—not just a renderer.</p>
</div>
</header>
<div class="wrap doc">
<nav class="toc" aria-label="On this page">
- <a href="#premise">1 · The premise</a>
- <a href="#ps3">2 · The PS3, seen from WebGL</a>
- <a href="#triangle">3 · One triangle, five stages</a>
- <a href="#bridge">4 · From three.js to the RSX</a>
- <a href="#shaders">5 · Shaders for a 2006 GPU</a>
- <a href="#bugs">6 · Five bugs</a>
- <a href="#measured">7 · What it measured</a>
- <a href="#threert">8 · What it means for ThreeRT</a>
+ <a href="#weird">1 · What makes the PS3 GPU weird</a>
+ <a href="#triangle">2 · One triangle, side by side</a>
+ <a href="#bridge">3 · Bridging Three.js to the RSX</a>
+ <a href="#shaders">4 · Pushing NV40 shaders</a>
+ <a href="#bugs">5 · Five wild bugs</a>
+ <a href="#results">6 · Live 1080p results</a>
+ <a href="#threert">7 · RT means runtime</a>
<a href="../">← Blog</a>
</nav>
<main class="prose">
- <figure class="fig" style="margin-top:0">
- <img src="../../media/ps3/showroom.webp" srcset="../../media/ps3/showroom-800.webp 800w, ../../media/ps3/showroom.webp 1600w" sizes="(max-width: 960px) calc(100vw - 40px), 820px" width="1600" height="900" alt="A Sony PS3 frame at 1920 by 1080: a gold torus knot, PBR satellites and a mirrored floor, under a PocketJS overlay reading 20 fps, 25,990 triangles and 26 draws">
- <figcaption>Read from the RSX’s front buffer over the network at 1920 × 1080: a <code>TorusKnotGeometry</code> in a <code>MeshPhysicalMaterial</code>, three coloured <code>PointLight</code>s, an environment map, 260 additive embers, a planar mirror drawn with the stencil buffer, and the PocketJS overlay.</figcaption>
- </figure>
-
- <div class="intro">
- <p>Running JavaScript on old consoles is not new, and neither is three.js outside a browser tab: desktop apps have shipped it for years, with a browser inside them. What we believe is new is three.js itself on hardware where it could not run at all: the scene code you already write, unchanged, drawn by a GPU from 2006, with a small native runtime in place of a browser.</p>
- <p>This post is how we got there: what three.js needs from a machine, how the PS3 draws when you look at it from WebGL, what we built in between, the five bugs that cost us the most, and what it measured. The work is part of <a href="../../">ThreeRT</a>, the native runtime for three.js.</p>
+ <div class="intro" style="margin-top:0">
+ <p>If you write WebGL or Three.js for fun, you live inside a remarkably polite abstraction. You call <code>new THREE.TorusKnotGeometry()</code>, hand it a <code>MeshPhysicalMaterial</code>, drop three <code>PointLight</code>s into a <code>Scene</code>, and call <code>renderer.render(scene, camera)</code>. Beneath that line sits an entire civilization of software: a JIT-compiled JavaScript engine, a browser compositor, ANGLE, OpenGL or Metal or Vulkan, and a multi-hundred-megabyte GPU driver quietly managing memory, compiling GLSL, and hiding hardware weirdness.</p>
+ <p class="beat">Now take all of that away.</p>
+ <p>No Chrome. No Electron. No WebGL, no OpenGL, no Vulkan, no Metal, no wgpu, and no JavaScript JIT. Just a <b>2006 PlayStation 3</b>—a 3.2 GHz big-endian PowerPC Cell with 256 MiB of main memory, paired with NVIDIA’s <b>RSX “Reality Synthesizer”</b> and its own 256 MiB of GDDR3—running <b>vanilla <code>[email protected]</code></b> (<code>import * as THREE from "three"</code>) at native <b>1920 × 1080</b>, with a <b>PocketJS</b> (SolidJS + Tailwind) HUD composited on top at 3× density.</p>
</div>
- <section id="premise" style="margin-top:56px">
- <span class="num">01</span>
- <h2>The premise</h2>
- <p>three.js has always come with a browser, and it is easy to think it needs one. It does not. Its scene graph, math, geometry generators, materials, lights and cameras are plain JavaScript with no DOM in them. Two things need the browser: the renderer, which speaks WebGL or WebGPU, and the JIT that keeps the renderer’s per-frame JavaScript fast.</p>
- <div class="then-now">
- <div><span>Until now</span><p>three.js ran where a browser ran. Outside the web you shipped one with it: Electron, a WebView. On a machine with no WebGL or WebGPU and no JIT, three.js did not run at all.</p></div>
- <div class="now"><span>Now</span><p><code>[email protected]</code>, imported as it is, builds the scene on the PS3’s Cell; a renderer we wrote draws it on the RSX at 1920 × 1080; PocketJS draws the interface into the same frame. Four demos run at 16 to 30 fps.</p></div>
- </div>
- <p>So we split the two. We kept everything of three.js that is plain JavaScript and replaced one thing, the renderer: once a frame, <code>RSXRenderer</code> walks the three.js scene and hands it to C code that draws on the RSX. The JavaScript runs on QuickJS, an interpreter with no JIT, on the Cell’s PowerPC core.</p>
- <p>The console is a PlayStation 3 Slim (CECH-2500) on system software 4.81 with custom firmware, which homebrew needs. What carries over, and what does not yet:</p>
- <dl class="kr"><dt>keeps</dt><dd>the scene: <code>Mesh</code>, <code>InstancedMesh</code>, <code>Points</code>, <code>Line</code>; standard, physical, Phong, Lambert, basic and normal materials; ambient, hemisphere, directional and point lights; fog</dd><dt>replaces</dt><dd><code>WebGLRenderer</code>, with <code>RSXRenderer</code> and native code</dd><dt>not yet</dt><dd>what lives inside three.js’s renderer: shadows, <code>ShaderMaterial</code> and TSL, three.js’s post-processing</dd></dl>
- </section>
+ <figure class="fig">
+ <img src="../../media/ps3/showroom.webp" srcset="../../media/ps3/showroom-800.webp 800w, ../../media/ps3/showroom.webp 1600w" sizes="(max-width: 960px) calc(100vw - 40px), 820px" width="1600" height="900" alt="A PlayStation 3 frame at 1920 by 1080: a gold torus knot, PBR satellites and a mirrored floor, under a PocketJS HUD reading 20 fps, 25,990 triangles and 26 draws">
+ <figcaption>Captured straight from a PlayStation 3 Slim’s RSX front buffer over TCP: a liquid-gold <code>TorusKnotGeometry</code>, three orbiting coloured <code>PointLight</code>s, studio reflections, 260 additive embers, a hardware-stenciled real-time mirror floor, and a translucent SolidJS HUD—all driven by real <code>[email protected]</code>.</figcaption>
+ </figure>
- <section id="ps3">
- <span class="num">02</span>
- <h2>The PS3, seen from WebGL</h2>
- <p>If you know WebGL, you know how the PS3 rasterizes: vertex and index buffers, depth testing, fragment programs, blending. What changes is everything around them. In a browser, a driver places your memory, compiles your shaders and synchronizes with the GPU. On a PS3 there is no driver: that is your code.</p>
+ <p>This post is the engineering story behind that screenshot: what makes the PS3’s graphics architecture genuinely strange if you come from WebGL, how we bridged unmodified Three.js r187 onto raw RSX command buffers and hand-written NV40 assembly shaders, five wild bugs we caught by disassembling the console toolchain, and what this means for <a href="../../">ThreeRT</a>—the native runtime for Three.js.</p>
- <figure class="dg">
- <span class="ttl">Drawing a three.js scene, in a browser and on a PS3</span>
- <div class="stacks">
- <div class="stk">
- <h4>In a browser<small>WebGL</small></h4>
- <div class="ly same">Your three.js scene</div>
- <div class="ly">three.js <code>WebGLRenderer</code></div>
- <div class="ly">JavaScript, JIT-compiled<small>V8 or JavaScriptCore</small></div>
- <div class="ly">WebGL → GPU process → ANGLE</div>
- <div class="ly">The OS driver<small>compiles GLSL, places memory, synchronizes</small></div>
- <div class="ly">A unified-shader GPU</div>
- <div class="ly">The compositor → a window</div>
- </div>
- <div class="stk">
- <h4>On a Sony PS3<small>RSX</small></h4>
- <div class="ly same">Your three.js scene<small>[email protected], as it is</small></div>
- <div class="ly ours"><code>RSXRenderer</code><small>walks the scene, packs typed arrays</small></div>
- <div class="ly">JavaScript, interpreted<small>QuickJS on the Cell PPU, big-endian</small></div>
- <div class="ly ours">A C host writes the command FIFO<small>PSL1GHT, packets of 32-bit words</small></div>
- <div class="ly you">Your code is the driver<small>allocates VRAM, fences, flips</small></div>
- <div class="ly">The RSX<small>separate vertex and fragment units</small></div>
- <div class="ly">HDMI scanout, no compositor</div>
- </div>
- </div>
- <p class="lg"><span><i class="same"></i>the same on both</span><span><i class="ours"></i>what we wrote</span><span><i class="you"></i>the driver’s job in a browser, ours on a PS3</span></p>
- </figure>
+ <section id="weird" style="margin-top:56px">
+ <span class="num">01</span>
+ <h2>What makes the PS3 GPU weird (through WebGL eyes)</h2>
+ <p>If you know <code>WebGLRenderingContext</code>, you already have the right mental model for rasterization: vertex buffers, index buffers, depth testing, fragment shaders and blending all exist on the PS3. What changes is <em>everything around them</em>.</p>
- <h3>Two memories, and you manage both</h3>
- <p>Memory is split in two: 256 MiB of XDR for the Cell, where QuickJS, three.js and PocketJS live, and 256 MiB of GDDR3 for the RSX. You allocate GPU memory yourself (<code>rsxMemalign</code>), turn CPU pointers into the offsets the RSX understands (<code>rsxAddressToOffset</code>), order your writes with a PowerPC barrier (<code>eieio</code>) and invalidate the RSX’s vertex and texture caches when you change what is in them. Two 1080p colour buffers and a depth-and-stencil buffer take about 25 MB; the rest is for meshes, textures and glyph atlases.</p>
+ <h3>Split memory, zero driver hand-holding</h3>
+ <p>In WebGL, <code>gl.bufferData()</code> and <code>gl.texImage2D()</code> hand bytes to a driver that decides where they live, migrates them on demand, and cleans up after you. On a PlayStation 3, memory is physically split in two:</p>
+ <ul>
+ <li><b>256 MiB of XDR</b> for the Cell, where QuickJS, Three.js and PocketJS live</li>
+ <li><b>256 MiB of GDDR3</b> for the RSX (500 MHz core, 24 pixel pipelines, 8 vertex units)</li>
+ </ul>
+ <p>You allocate VRAM yourself with <code>rsxMemalign(64, bytes)</code>, translate raw pointers into the offsets the RSX understands (<code>rsxAddressToOffset</code>), order your writes with a PowerPC barrier (<code>eieio</code>), and explicitly invalidate the vertex and texture caches whenever you upload new data. Two 1920 × 1080 <code>A8R8G8B8</code> colour buffers cost about 16.6 MB; a full 1080p <code>Z24S8</code> depth-and-stencil buffer costs another 8.3 MB. That still leaves more than 200 MiB of VRAM for meshes, textures and glyph atlases.</p>
<figure class="dg">
<span class="ttl">The two memories, and the command FIFO between them</span>
- <svg class="mem" viewBox="0 0 760 300" role="img" aria-label="The Cell's XDR memory holds QuickJS, three.js, PocketJS and the command FIFO. The CPU writes packets at put; the RSX fetches them by DMA at get; the FIFO jumps back to its start when the RSX is idle. The RSX's GDDR3 holds vertex buffers, textures, fragment programs and framebuffers.">
+ <svg class="mem" viewBox="0 0 760 300" role="img" aria-label="The Cell's XDR memory holds QuickJS, Three.js, PocketJS and the command FIFO. The CPU writes packets at put; the RSX fetches them by DMA at get; the FIFO jumps back to its start when the RSX is idle. The RSX's GDDR3 holds vertex buffers, textures, fragment programs and framebuffers.">
<defs><marker id="ah" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0 0L10 5L0 10z" fill="#bdb8af"/></marker></defs>
<rect x="8" y="16" width="452" height="268" rx="16" class="box"/>
<text x="28" y="46" class="t1">Cell PPU · 3.2 GHz</text>
- <text x="28" y="66" class="t2">256 MiB XDR · QuickJS · three.js · PocketJS</text>
+ <text x="28" y="66" class="t2">256 MiB XDR · QuickJS · Three.js · PocketJS</text>
<text x="28" y="122" class="t3">command FIFO · 2 MiB</text>
<g class="tape">
<rect x="28" y="134" width="28" height="34" class="done"/><rect x="57" y="134" width="28" height="34" class="done"/><rect x="86" y="134" width="28" height="34" class="done"/><rect x="115" y="134" width="28" height="34" class="done"/>
@@ -251,19 +242,32 @@
<rect x="520" y="174" width="212" height="34" rx="8" class="cell hot"/><text x="534" y="196" class="t3">fragment programs</text>
<rect x="520" y="216" width="212" height="34" rx="8" class="cell"/><text x="534" y="238" class="t3">2 × 1080p colour · Z24S8</text>
</svg>
- <figcaption>Done words are grey, words the RSX has not reached yet are lit. The fragment programs live in GPU memory, which matters below.</figcaption>
+ <figcaption>Words the RSX has already read are grey; words it has not reached yet are lit. Note where the fragment programs live—in GPU memory. That matters in a minute.</figcaption>
</figure>
- <h3>No driver: you write the command stream</h3>
- <p>There is no <code>gl.drawElements()</code> on PS3 homebrew. The CPU and the RSX share a ring of 32-bit words, the command FIFO: every graphics call writes a method header and its arguments at <code>put</code>, and the RSX’s <code>get</code> chases it. Two things follow.</p>
- <ul>
- <li><b>You own synchronization.</b> Overwrite a buffer the RSX has not read yet, or rewind the ring while <code>get</code> is behind <code>put</code>, and it reads garbage and locks the console. You fence with <code>rsxFinish</code> and an increasing reference, and present with <code>gcmSetFlip</code>.</li>
- <li><b>You own the ring’s end.</b> Write more in one frame than the segment holds without jumping back to its start (<code>rsxSetJumpCommand</code>) and you run off its end. An <code>InstancedMesh</code> taught us this; see bug 5.</li>
- </ul>
-
- <h3>Two shader units, and fragment constants live inside the program</h3>
- <p>The RSX comes from NVIDIA’s G70, the GeForce 7800 generation, and PSL1GHT drives it with NV40-class registers and assembly. It is the last generation before unified shaders: vertex programs (<code>!!VP2.0</code>) and fragment programs (<code>!!FP2.0</code>) run on different units with different rules. Vertex programs read constants from a bank of <code>vec4</code> registers, <code>c[…]</code>, loaded through the FIFO. Fragment programs have no such bank.</p>
- <p>A fragment “uniform” is a 16-byte slot in the program’s own machine code. The assembler leaves the slot and records where it is. To set it, you write the value into the program in GPU memory, with a DMA write ordered with your other commands (<code>rsxInlineTransfer</code>), and every 32-bit float has its two 16-bit halves swapped, because that is the order in which the fragment unit fetches words. Then you point the RSX at the program again so it does not run a stale copy.</p>
+ <h3>No OpenGL—you speak the raw command FIFO</h3>
+ <p>There is no <code>gl.drawElements()</code> driver layer in PS3 homebrew (PSL1GHT, the open-source take on <code>libgcm</code>). Instead, the CPU and GPU talk through a <b>DMA ring buffer—the command FIFO</b>—in shared memory. Every “graphics call” simply writes 32-bit method headers and payload words at <code>ctx-&gt;current</code>, then rings the doorbell (<code>rsxFlushBuffer</code>) so the RSX’s <code>get</code> pointer chases your <code>put</code> pointer.</p>
+ <p>That has two huge consequences for a WebGL developer:</p>
+ <ol>
+ <li><b>You own synchronization.</b> Overwrite a vertex buffer, or rewind the ring, while the RSX’s <code>get</code> is still behind your <code>put</code>, and it reads garbage and hard-locks the console. You fence with <code>rsxFinish(ctx, ++ref)</code> and pace display flips with <code>gcmSetFlip</code> and <code>gcmSetWaitFlip</code>.</li>
+ <li><b>You own the ring’s end.</b> Push too many commands in one frame without jumping back to the start with <code>rsxSetJumpCommand</code>, and you run straight off the end of the segment. (How <code>THREE.InstancedMesh</code> taught us this the hard way is bug 5.)</li>
+ </ol>
+
+ <h3>Pre-unified shaders—and the wildest uniform mechanism you’ve ever seen</h3>
+ <p>The RSX descends from NVIDIA’s G70, the GeForce 7800 GTX generation, and PSL1GHT drives it with NV40-class registers and assembly. That is the last generation <em>before</em> unified shader cores: vertex programs (<code>!!VP2.0</code>) and fragment programs (<code>!!FP2.0</code>) run on completely different processors with completely different rules.</p>
+ <div class="tbl">
+ <table>
+ <thead><tr><th></th><th>WebGL (GLSL)</th><th>RSX vertex <code>!!VP2.0</code></th><th>RSX fragment <code>!!FP2.0</code></th></tr></thead>
+ <tbody>
+ <tr><th>Uniform storage</th><td>uniforms, UBOs</td><td>a bank of <code>vec4</code> registers, <code>c[…]</code></td><td class="hot"><b>none!</b></td></tr>
+ <tr><th>Setting one</th><td><code>gl.uniform4f(…)</code></td><td>a block load through the FIFO</td><td class="hot"><b>patched into the program’s microcode, in VRAM</b></td></tr>
+ <tr><th>Constants per instruction</th><td>as many as you like</td><td>at most one <code>c[k]</code></td><td>at most one <code>c[k]</code></td></tr>
+ <tr><th>Interpolators</th><td><code>varying</code>s</td><td><code>o[COL0..1]</code>, <code>o[TEX0..7]</code></td><td><code>f[COL0..1]</code>, <code>f[TEX0..7]</code></td></tr>
+ </tbody>
+ </table>
+ </div>
+ <p>Read that second row again. <b>The RSX fragment processor has no uniform registers.</b></p>
+ <p>When you declare a fragment uniform like <code>uCamPos</code> or <code>uDirCol</code>, the assembler (<code>cgcomp</code>) leaves a 16-byte hole right inside the fragment program’s machine code and records its byte offset in a constant table. Setting a fragment uniform literally means issuing a GPU-ordered DMA write (<code>rsxInlineTransfer</code>) that <b>self-modifies the fragment program in VRAM</b>—with every 32-bit float halfword-swapped, <code>(bits &gt;&gt; 16) | (bits &lt;&lt; 16)</code>, because that is the order the fragment unit fetches words in—and then pointing the RSX at the program again so it doesn’t run a stale copy.</p>
<figure class="dg">
<span class="ttl">Setting uTint = (1.0, 0.85, 0.4, 1.0) in a fragment program</span>
@@ -281,73 +285,125 @@
<li><b>Point the RSX at the program again</b><code>rsxLoadFragmentProgramLocation(…)</code></li>
</ol>
</div>
- <figcaption>The instruction words are illustrative; the slot’s bytes are the real swapped values. In a browser the same thing is <code>gl.uniform4f(loc, 1, 0.85, 0.4, 1)</code>.</figcaption>
+ <figcaption>The instruction words are illustrative; the slot’s bytes are the real swapped values. In a browser, all of this is <code>gl.uniform4f(loc, 1, 0.85, 0.4, 1)</code>.</figcaption>
</figure>
- <h3>Big-endian on both sides</h3>
- <p>The Cell is big-endian, and so is the RSX. QuickJS keeps a <code>Float32Array</code> in the CPU’s byte order, which is the order the RSX reads vertices and indices in. So when three.js fills a <code>BufferGeometry</code> or an <code>InstancedMesh</code>’s matrices, our bridge takes the array’s memory and copies it to the GPU as it is: no per-element conversion, no byte swapping.</p>
+ <h3>The big-endian silver lining</h3>
+ <p>The Cell is big-endian PowerPC. In WebGL on x86 or ARM you almost never think about byte order. On the PS3, QuickJS stores <code>Float32Array</code>, <code>Uint16Array</code> and <code>Uint32Array</code> in the CPU’s native order—which is <em>also</em> the order the RSX reads vertices and indices in.</p>
+ <p>So when Three.js builds a <code>BufferGeometry</code> or updates <code>InstancedMesh.instanceMatrix.array</code>, our C bridge grabs the array’s memory with <code>JS_GetTypedArrayBuffer</code> and copies it <b>straight into VRAM, with no per-element boxing and no byte swapping</b>.</p>
+
+ <h3>Two completely different worlds</h3>
+ <p>Before looking at code, here is the gap between drawing in a browser and drawing on PS3 bare metal:</p>
+ <figure class="dg">
+ <span class="ttl">Drawing a Three.js scene, in a browser and on a PS3</span>
+ <div class="stacks">
+ <div class="stk">
+ <h4>In a browser<small>WebGL · managed and unified</small></h4>
+ <div class="ly same">Your Three.js scene</div>
+ <div class="ly">Three.js <code>WebGLRenderer</code></div>
+ <div class="ly">JavaScript, JIT-compiled<small>V8 or JavaScriptCore</small></div>
+ <div class="ly">WebGL → GPU process → ANGLE</div>
+ <div class="ly">The OS driver<small>compiles GLSL, places memory, synchronizes</small></div>
+ <div class="ly">A unified-shader GPU<small>shared register file, uniform buffers</small></div>
+ <div class="ly">The compositor → a window</div>
+ </div>
+ <div class="stk">
+ <h4>On a PlayStation 3<small>RSX · explicit and pre-unified</small></h4>
+ <div class="ly same">Your Three.js scene<small>[email protected], as it is</small></div>
+ <div class="ly ours"><code>RSXRenderer</code><small>walks the scene, packs typed arrays</small></div>
+ <div class="ly">JavaScript, interpreted<small>QuickJS on the big-endian Cell PPU</small></div>
+ <div class="ly ours">A thin C bridge writes the 2 MiB FIFO<small>PSL1GHT, packets of 32-bit words</small></div>
+ <div class="ly you">Your code is the driver<small>allocates VRAM, fences, flips</small></div>
+ <div class="ly">The RSX<small>VP2.0 → FP2.0, constants patched into VRAM</small></div>
+ <div class="ly">HDMI scanout at 1920 × 1080, no compositor</div>
+ </div>
+ </div>
+ <p class="lg"><span><i class="same"></i>the same on both</span><span><i class="ours"></i>what we wrote</span><span><i class="you"></i>the driver’s job in a browser, ours on a PS3</span></p>
+ </figure>
+ <p>Notice how many layers disappear on the right—and how much responsibility moves straight into your own C code.</p>
</section>
<section id="triangle">
- <span class="num">03</span>
- <h2>One triangle, five stages</h2>
- <p>The same coloured triangle, drawn both ways. Every design choice in the three.js renderer comes out of these five differences.</p>
+ <span class="num">02</span>
+ <h2>Side by side: drawing one triangle in WebGL vs. the RSX</h2>
+ <p>Every graphics programmer learns by drawing a single coloured triangle. Walking through the <b>five stages</b> of that one triangle side by side makes the PS3 click—and explains every optimization we had to build for Three.js later.</p>
- <h3>1 · Upload the vertices</h3>
+ <h3>Stage 1 · Uploading vertex data</h3>
+ <p>In WebGL you hand a <code>Float32Array</code> to the driver and forget where it lives. On the RSX you carve aligned bytes out of GDDR3 yourself, enforce a PowerPC memory barrier, convert the CPU pointer into an RSX offset, and flush the GPU’s vertex cache:</p>
<div class="two">
- <div><span class="lbl">WebGL</span><pre class="code js">// The driver places and caches it.
+ <div><span class="lbl">WebGL</span><pre class="code js">// The driver allocates, aligns,
+// migrates and caches it for you.
const vbo = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
gl.bufferData(gl.ARRAY_BUFFER, verts,
gl.STATIC_DRAW);</pre></div>
- <div><span class="lbl">PS3</span><pre class="code">// Aligned GPU memory, a barrier, an offset, a cache flush.
+ <div><span class="lbl">PS3 RSX</span><pre class="code">// Explicit VRAM, a barrier, an offset, a cache flush.
TriVert *vb = rsxMemalign(64, 3 * sizeof(TriVert));
memcpy(vb, triangle, 3 * sizeof(TriVert));
-__asm__ volatile("eieio" ::: "memory");
-u32 vb_off; rsxAddressToOffset(vb, &amp;vb_off);
-rsxInvalidateVertexCache(ctx);</pre></div>
+__asm__ volatile("eieio" ::: "memory"); // reach GDDR3
+u32 vb_off;
+rsxAddressToOffset(vb, &amp;vb_off); // offsets, never pointers
+rsxInvalidateVertexCache(ctx); // old vertices are stale</pre></div>
</div>
- <h3>2 · Load the shaders</h3>
- <p>GLSL compiles on the user’s machine. RSX programs are assembled before the build (<code>cgcomp -a</code>); the vertex program is sent through the FIFO, and the fragment program is copied into GPU memory, because the RSX fetches fragment instructions from there.</p>
+ <h3>Stage 2 · Writing and loading shaders</h3>
+ <p>In WebGL, GLSL strings compile on the user’s machine at run time. On the RSX, shaders are assembled <b>offline</b> into separate <code>!!VP2.0</code> and <code>!!FP2.0</code> microcode (<code>cgcomp -a</code>). Vertex microcode goes inline over the FIFO, but <b>fragment microcode has to be copied into 64-byte-aligned VRAM</b>, because the RSX fetches pixel instructions straight from GDDR3:</p>
<div class="two">
<div><span class="lbl">WebGL</span><pre class="code js">// GLSL, compiled at run time.
gl_Position = uMVP * vec4(aPos, 1.0);
vColor = aColor;
// …
gl_FragColor = vColor * uTint;</pre></div>
- <div><span class="lbl">PS3</span><pre class="code"># !!VP2.0: c[0..3] are the rows of uMVP
+ <div><span class="lbl">PS3 RSX</span><pre class="code"># !!VP2.0: c[0..3] are the rows of uMVP
DP4 R0.x, v[0], c[0]; DP4 R0.y, v[0], c[1];
DP4 R0.z, v[0], c[2]; DP4 R0.w, v[0], c[3];
MOV o[HPOS], R0; MOV o[COL0], v[3];
-# !!FP2.0: c[0] is the uTint slot
+# !!FP2.0: uTint is a 16-byte hole in the ucode
MOV R1, c[0];
-MULR o[COLR], f[COL0], R1;</pre></div>
+MULR o[COLR], f[COL0], R1;
+
+// C: the fragment program goes into VRAM
+void *fp_vram = rsxMemalign(64, fp_size);
+memcpy(fp_vram, fp_src, fp_size);
+rsxAddressToOffset(fp_vram, &amp;fp_off);</pre></div>
</div>
- <h3>3 · Set the uniforms</h3>
- <p>Here the two worlds part. A vertex constant is a block load through the FIFO, cheap enough for every draw. A fragment constant is a write into the program and a reload of it.</p>
+ <h3>Stage 3 · Updating uniforms (the biggest mental shift)</h3>
+ <p>In WebGL, vertex and fragment uniforms look identical. On the RSX they are <b>two completely different hardware mechanisms</b>:</p>
<div class="two">
- <div><span class="lbl">WebGL</span><pre class="code js">gl.uniformMatrix4fv(locMVP, false, mvp);
+ <div><span class="lbl">WebGL</span><pre class="code js">// Symmetric across stages.
+gl.useProgram(program);
+gl.uniformMatrix4fv(locMVP, false, mvp);
gl.uniform4f(locTint, 1.0, 0.85, 0.4, 1.0);</pre></div>
- <div><span class="lbl">PS3</span><pre class="code">// Vertex: four rows into c[0..3].
+ <div><span class="lbl">PS3 RSX</span><pre class="code">// 1. Vertex: a FIFO block load into c[0..3]
+// (Three.js is column-major; DP4 wants rows)
rsxLoadVertexProgramParameterBlock(ctx, 0, 4, mvp_rows);
-// Fragment: into the program itself, halves swapped.
+
+// 2. Fragment: self-modify the program in VRAM,
+// each float's 16-bit halves swapped
for (u32 i = 0; i &lt; tab-&gt;num; i++)
rsxInlineTransfer(ctx, fp_off + tab-&gt;offset[i],
swapped, 4, GCM_LOCATION_RSX);
+// Point the RSX at the program again
rsxLoadFragmentProgramLocation(ctx, fp, fp_off,
GCM_LOCATION_RSX);</pre></div>
</div>
+ <aside class="aha"><b>Aha moment for WebGL devs:</b> this single difference explains our entire Three.js renderer design. Setting a vertex constant is cheap enough for every draw; patching a fragment uniform writes into VRAM and reloads the program. So <code>RSXRenderer</code> patches <b>scene-wide lighting</b> into <code>pbr3d.fp</code> once per pass, and passes <b>every per-mesh material value</b>—colour, roughness, metalness, emissive, UV transform—through vertex constants and interpolators.</aside>
- <h3>4 · Draw</h3>
- <p>WebGL’s clip space has +Y up and the screen comes out right. The RSX scans out top-down with depth from 0 to 1, so a viewport with a negative Y scale maps three.js’s clip space onto it; attributes are bound by GPU offset.</p>
+ <h3>Stage 4 · Binding attributes, viewport and the draw</h3>
+ <p>In WebGL, OpenGL’s convention (+Y up, depth from −1 to 1) is automatic. On the RSX you bind the colour + <code>Z24S8</code> surface yourself, set a <b>negative-Y viewport scale</b> so Three.js’s +Y-up clip space lands right side up on the PS3’s top-down scanout, bind attributes by VRAM offset, and emit the draw packet into the FIFO:</p>
<div class="two">
<div><span class="lbl">WebGL</span><pre class="code js">gl.viewport(0, 0, 1920, 1080);
+gl.clear(gl.COLOR_BUFFER_BIT |
+ gl.DEPTH_BUFFER_BIT);
gl.vertexAttribPointer(0, 3, gl.FLOAT,
false, 28, 0);
gl.drawArrays(gl.TRIANGLES, 0, 3);</pre></div>
- <div><span class="lbl">PS3</span><pre class="code">f32 scale[4] = { 960, -540, 0.5f, 0 };
+ <div><span class="lbl">PS3 RSX</span><pre class="code">rsxSetSurface(ctx, &amp;surface); // A8R8G8B8 + Z24S8
+rsxClearSurface(ctx, GCM_CLEAR_R | GCM_CLEAR_G |
+ GCM_CLEAR_B | GCM_CLEAR_A | GCM_CLEAR_Z | GCM_CLEAR_S);
+// NDC (+Y up, z in [-1, 1]) -> top-down, z in [0, 1]
+f32 scale[4] = { 960, -540, 0.5f, 0 };
f32 offset[4] = { 960, 540, 0.5f, 0 };
rsxSetViewport(ctx, 0, 0, 1920, 1080, 0, 1, scale, offset);
rsxBindVertexArrayAttrib(ctx, GCM_VERTEX_ATTRIB_POS, 0,
@@ -356,106 +412,188 @@ rsxBindVertexArrayAttrib(ctx, GCM_VERTEX_ATTRIB_POS, 0,
rsxDrawVertexArray(ctx, GCM_TYPE_TRIANGLES, 0, 3);</pre></div>
</div>
- <h3>5 · Present</h3>
- <p>In a browser you return from <code>requestAnimationFrame</code>. On a PS3 nothing reaches the TV until you flush the FIFO, fence the RSX, rewind the ring, wait for the last flip and queue the next.</p>
+ <h3>Stage 5 · Presenting the frame (sync, rewind, flip)</h3>
+ <p>In WebGL, presentation is invisible—you just return from <code>requestAnimationFrame</code>. On the RSX, <em>nothing</em> reaches your TV until you flush the FIFO, fence the GPU, rewind the ring so it never overflows, wait for the previous flip, and queue the next scanout buffer:</p>
<div class="two">
- <div><span class="lbl">WebGL</span><pre class="code js">requestAnimationFrame(loop);</pre></div>
- <div><span class="lbl">PS3</span><pre class="code">rsxFlushBuffer(ctx);
+ <div><span class="lbl">WebGL</span><pre class="code js">// The browser flushes, waits for
+// vsync and composites for you.
+function loop() {
+ drawTriangle();
+ requestAnimationFrame(loop);
+}</pre></div>
+ <div><span class="lbl">PS3 RSX</span><pre class="code">rsxFlushBuffer(ctx);
rsxFinish(ctx, ++ref); // the RSX is done
rsxSetJumpCommand(ctx, begin_off); // rewind the ring
+ctx-&gt;current = ctx-&gt;begin;
while (gcmGetFlipStatus() != 0) usleep(200);
gcmResetFlipStatus();
while (gcmSetFlip(ctx, fb) != 0) usleep(200);
rsxFlushBuffer(ctx);
gcmSetWaitFlip(ctx);
-fb ^= 1;</pre></div>
+fb ^= 1; // swap front and back</pre></div>
</div>
+ <p>Once you’ve seen those five stages side by side, nothing about PS3 graphics feels mysterious anymore—and every design decision in our Three.js adapter follows straight from them.</p>
</section>
<section id="bridge">
- <span class="num">04</span>
- <h2>From three.js to the RSX</h2>
- <p>The showcase starts with <code>import * as THREE from "three"</code>. <code>RSXRenderer</code> (<code>platforms/ps3/three-rsx-renderer.ts</code>) walks that scene and talks to the C engine (<code>platforms/ps3/rsx3d.c</code>) through one global object, <code>globalThis.__rsx3d</code>, whose arguments are typed arrays.</p>
+ <span class="num">03</span>
+ <h2>Bridging vanilla Three.js r187 to the RSX + PocketJS</h2>
+ <p>Here’s the secret that makes real <code>[email protected]</code> possible on a 2006 console: <b>Three.js’s scene graph, math library, geometry generators, materials, lights and cameras are plain ES-module JavaScript with no DOM dependencies.</b> Only the renderer touches a <code>&lt;canvas&gt;</code>.</p>
+ <p>So we didn’t fork Three.js, and we didn’t write a toy “Three-like” clone. The showcase app literally starts with:</p>
+ <pre class="code js">import * as THREE from "three";</pre>
+ <p>…and our own <b><code>RSXRenderer</code></b> (<code>platforms/ps3/three-rsx-renderer.ts</code>) walks the real <code>THREE.Scene</code> and drives a native C engine (<code>platforms/ps3/rsx3d.c</code>) through one thin typed-array bridge, <code>globalThis.__rsx3d</code>:</p>
<figure class="dg">
- <span class="ttl">One frame, from the three.js scene to the TV</span>
+ <span class="ttl">One frame, from the Three.js scene to the TV</span>
<div class="lanes">
<div class="lane"><span class="ln">QuickJS · Cell PPU</span>
- <div class="flow"><div class="bx same"><b>three.js scene</b><small>Scene · Mesh · InstancedMesh · Points · lights</small></div><span class="ar">→</span><div class="bx ours"><b>RSXRenderer</b><small>walk · sort · pack Float32Array</small></div><span class="ar">+</span><div class="bx same"><b>PocketJS</b><small>Solid JSX + Tailwind, 3× density</small></div></div></div>
+ <div class="flow"><div class="bx same"><b>Three.js r187</b><small>Scene · Mesh · InstancedMesh · Points · lights</small></div><span class="ar">→</span><div class="bx ours"><b>RSXRenderer</b><small>walk · sort · pack Float32Array</small></div><span class="ar">+</span><div class="bx same"><b>PocketJS</b><small>SolidJS + Tailwind, 3× density</small></div></div></div>
<div class="lane"><span class="ln">C host · PSL1GHT</span>
- <div class="flow"><div class="bx ours"><b>__rsx3d</b><small>typed arrays, read where they are</small></div><span class="ar">→</span><div class="bx ours"><b>rsx3d</b><small>GPU memory pools · constants · mirror</small></div><span class="ar">→</span><div class="bx ours"><b>rsx_driver</b><small>Z24S8 surface · FIFO rewind · flip</small></div></div></div>
+ <div class="flow"><div class="bx ours"><b>__rsx3d</b><small>typed arrays, read where they are</small></div><span class="ar">→</span><div class="bx ours"><b>rsx3d</b><small>VRAM pools · constants · mirror</small></div><span class="ar">→</span><div class="bx ours"><b>rsx_driver</b><small>Z24S8 surface · FIFO rewind · flip</small></div></div></div>
<div class="lane"><span class="ln">RSX · 1920 × 1080</span>
- <div class="flow"><div class="bx gpu"><b>Pass 1 · 3D</b><small>sky · mirror · PBR · points</small></div><span class="ar">→</span><div class="bx gpu"><b>Pass 2 · UI</b><small>over the 3D, no clear</small></div><span class="ar">→</span><div class="bx gpu"><b>Front buffer</b><small>to HDMI, and over TCP :8623</small></div></div></div>
+ <div class="flow"><div class="bx gpu"><b>Pass 1 · 3D</b><small>sky · stencil mirror · PBR · points</small></div><span class="ar">→</span><div class="bx gpu"><b>Pass 2 · UI</b><small>alpha-blended over the 3D, no clear</small></div><span class="ar">→</span><div class="bx gpu"><b>Front buffer</b><small>to HDMI, and over TCP :8623</small></div></div></div>
</div>
- <figcaption>three.js and PocketJS share the CPU; one surface takes both passes, so there is no offscreen target and no extra full-screen copy.</figcaption>
+ <figcaption>Three.js and PocketJS share the CPU; one surface takes both passes, so there is no offscreen target and no extra full-screen copy.</figcaption>
</figure>
- <h3>Scene-wide values once a pass, per-object values per draw</h3>
- <p>A fragment constant costs a write into the program and a reload, so the renderer splits uniforms along that line. Values that are the same for the whole scene (the camera position and exposure, the directional light, three point lights, the hemisphere light, fog) are written into the PBR fragment program once a pass. Everything per object (its matrices, colour, emissive, roughness, metalness, UV transform) goes into vertex constants and reaches the fragment unit through interpolators. No fragment program is reloaded per mesh.</p>
-
- <h3>One call for an <code>InstancedMesh</code>, and what it still costs</h3>
- <p>QuickJS has no JIT, and calling into C once per instance with loose numbers would spend the frame on an in-order core. So for an <code>InstancedMesh</code> the renderer passes three.js’s own <code>instanceMatrix.array</code> and <code>instanceColor.array</code> to C in one call; C loads the shared material constants once and loops over the instances on the PPU.</p>
- <p>That keeps JavaScript out of the loop, but the RSX has no hardware instancing: every instance is still a draw with its own constants. With 196 instances, writing those commands takes 28.9 ms of the PPU’s time a frame, and that demo is the slowest, at 16 fps. The Cell has six SPUs doing nothing; this loop is the first thing to move onto them.</p>
+ <p>Vanilla means the package is untouched—what we replace is the renderer. What carries over, and what doesn’t yet:</p>
+ <dl class="kr"><dt>keeps</dt><dd>the scene: <code>Mesh</code>, <code>InstancedMesh</code>, <code>Points</code>, <code>Line</code>; standard, physical, Phong, Lambert, basic and normal materials; ambient, hemisphere, directional and point lights; fog</dd><dt>replaces</dt><dd><code>WebGLRenderer</code>, with <code>RSXRenderer</code> and native code</dd><dt>not yet</dt><dd>what lives inside Three.js’s own renderer: shadows, <code>ShaderMaterial</code> and TSL, its post-processing</dd></dl>
- <h3>Two passes into one frame</h3>
- <p><code>rsx_driver.c</code> binds one 1920 × 1080 colour surface with a 24-bit depth and 8-bit stencil buffer and calls the scene first. Pass 1 clears colour, depth and stencil and draws the 3D scene. Pass 2 clears nothing, resets the depth, stencil and cull state, and draws the PocketJS interface over it with alpha blending. PocketJS apps that draw no 3D do not change.</p>
+ <h3>Design trick #1: a zero-stall uniform split</h3>
+ <p>Patching fragment microcode stalls the fragment pipeline if you do it per mesh, so we split uniforms strictly along the NV40’s hardware grain:</p>
+ <ul>
+ <li><b>Scene-wide values</b>—camera position and exposure, the directional key light, three coloured point lights, hemisphere sky and ground, exponential fog—are patched into <code>pbr3d.fp</code> <b>once per pass</b>.</li>
+ <li><b>Per-draw and per-instance values</b>—MVP, model matrix, the inverse-transpose normal matrix, base colour, emissive, roughness / metalness / environment intensity, UV repeat and offset—go into <b>vertex constants</b> and reach the fragment program through the interpolators <code>o[COL0]</code> and <code>o[TEX0..4]</code>.</li>
+ </ul>
+ <p>Result: <b>no fragment program reloads per mesh</b>, even across hundreds of draws.</p>
+
+ <h3>Design trick #2: one native call per <code>InstancedMesh</code></h3>
+ <p>QuickJS is an interpreter—no V8, no JSC JIT. Calling into C 200 times a frame with loose floats would burn precious cycles on an in-order PowerPC core. So for a <code>THREE.InstancedMesh</code>, <code>RSXRenderer</code> hands Three.js’s own <code>instanceMatrix.array</code> and <code>instanceColor.array</code> to C in <b>one native call</b>:</p>
+ <pre class="code js">native.drawInstanced(geoId, texId, mats, cols, im.count, this.instBuf, flags);</pre>
+ <p>Inside <code>rsx3d.c</code>, C uploads the shared material constants once, then loops on the 3.2 GHz PPU computing <code>MVP = VP × M</code> and the normal matrix for each instance, uploading its constants and issuing <code>rsxDrawIndexArray</code> back to back—no vertex buffer or texture rebinds.</p>
+ <p>The honest cost: the RSX has no hardware instancing, so every instance is still its own draw. With 196 instances, writing those commands takes <b>28.9 ms</b> of PPU time a frame, and that demo is our slowest at 16 fps. The Cell’s SPUs are the obvious next home for that loop.</p>
+
+ <h3>Design trick #3: 3D and the PocketJS UI in one backbuffer</h3>
+ <p>Rather than rendering the 3D scene into an offscreen target and blitting it, <code>rsx_driver.c</code> calls the scene right after binding the 1920 × 1080 <code>A8R8G8B8</code> + <code>Z24S8</code> surface:</p>
+ <ol>
+ <li><b>Pass 1 (3D):</b> clear colour, depth and stencil, set the negative-Y viewport so Three.js’s right-handed clip space (+Y up, z from −1 to 1) works unmodified, and draw the scene.</li>
+ <li><b>Pass 2 (PocketJS UI):</b> skip the colour clear, reset depth, stencil, culling and polygon mode, switch to <code>ui.vp</code> / <code>ui.fp</code> with <code>SRC_ALPHA, ONE_MINUS_SRC_ALPHA</code>, and paint the SolidJS + Tailwind HUD straight over the 3D pixels at crisp 3× density.</li>
+ </ol>
+ <p>No extra full-screen pass, no extra render targets—and existing 2D-only PocketJS apps don’t change at all when no 3D scene is submitted.</p>
</section>
<section id="shaders">
- <span class="num">05</span>
- <h2>Shaders for a 2006 GPU</h2>
- <p>What makes a 2006 GPU look current is less how many triangles it draws than how materials answer light. Three things do most of that here.</p>
+ <span class="num">04</span>
+ <h2>Pushing NV40 shaders: PBR, trig-free IBL and stenciled reflections</h2>
+ <p>On a 2006 console, the trick to making 3D look genuinely modern isn’t brute-forcing polygon counts—it’s <b>material response</b>: specular sheen, Fresnel rims, a studio to reflect, and reflections that ground objects on the floor.</p>
+
+ <h3>Per-pixel PBR + ACES filmic tone mapping in <code>!!FP2.0</code></h3>
+ <p><code>pbr3d.fp</code> shades every one of the 1920 × 1080 pixels with metalness and roughness:</p>
<ul>
- <li><b>Per-pixel PBR.</b> Metalness and roughness, Schlick’s Fresnel without a <code>POW</code> (<code>x = 1 − N·V</code>, then <code>x²·x²·x</code>), a directional light with a roughness-scaled Blinn-Phong lobe and three point lights per pixel, then the ACES filmic curve, so highlights roll off instead of clipping.</li>
- <li><b>An environment map without trigonometry.</b> A 256 × 128 studio panorama (a warm softbox overhead, a cool strip at the side, a ring at the zenith) sampled along the reflection vector with a projection that needs no <code>atan2</code>: <code>t = R.x / (|R.x| + |R.z|)</code>, <code>u = R.z &lt; 0 ? 0.75 − 0.25t : 0.25 + 0.25t</code>, <code>v = 0.5 − 0.48 R.y</code>. The two halves meet at <code>u = 0.5</code> and wrap at 0 and 1.</li>
- <li><b>A planar mirror with the stencil buffer.</b> Draw the floor into the stencil only; draw the reflectable meshes flipped below it where the stencil is set, with the winding reversed; clear depth; draw the floor over them, partly transparent.</li>
+ <li><b>Schlick Fresnel without <code>POW</code>:</b> <code>x = 1 − N·V</code>, <code>x² = x·x</code>, <code>F = lerp(F0, 1, x²·x²·x)</code>, where <code>F0 = lerp(0.04, albedo, metalness)</code>.</li>
+ <li><b>Four lights per pixel:</b> a directional key light with a roughness-driven Blinn-Phong lobe normalized by <code>(specExp + 8) · 0.0398</code>, plus three coloured point lights with smooth inverse-square falloff.</li>
+ <li><b>ACES filmic tone mapping,</b> <code>c(2.51c + 0.03) / (c(2.43c + 0.59) + 0.14)</code>, so bright highlights roll off into soft cinema whites instead of clipping to harsh primaries—then <code>x · rsq(x)</code>, a square root, as a cheap gamma.</li>
</ul>
+
+ <h3>Trig-free 360° studio IBL</h3>
+ <p>Shiny gold and chrome look dead without something to reflect, and NV40 fragment programs hate <code>atan2</code> and <code>asin</code>. So we generate a 256 × 128 procedural studio panorama (a warm overhead softbox, a cool cyan rim strip, a zenith ring light, a glow along the horizon) and sample it along <code>R = 2(N·V)N − V</code> with a <b>trig-free, continuous 360° projection</b>:</p>
+ <pre class="code">t = R.x / (|R.x| + |R.z| + 0.0001)
+u = (R.z &lt; 0) ? (0.75 - 0.25 * t) : (0.25 + 0.25 * t)
+v = 0.5 - 0.48 * R.y</pre>
+ <p>At +X (<code>t = +1</code>) both branches meet at <code>u = 0.5</code>; at −X (<code>t = −1</code>) they meet at 0 and 1 under <code>GCM_TEXTURE_REPEAT</code>. Zero trig instructions, zero seams—and the reflection fades with roughness, so mirror chrome reads as liquid metal while matte ceramic stays soft.</p>
+
+ <h3>Real-time planar mirrors with the 8-bit stencil</h3>
+ <p>That crisp upside-down golden torus knot in the marble floor isn’t screen-space trickery—it’s a classic <b>hardware stencil</b> pass using our <code>Z24S8</code> buffer:</p>
+ <ol>
+ <li><b>Mask:</b> draw the floor with colour and depth writes off, stamping <code>stencil = 1</code>.</li>
+ <li><b>Reflect:</b> where <code>stencil == 1</code>, mirror the scene across <code>y = planeY</code> (<code>scale(1, −1, 1)</code>), mirror the lights’ Y, flip the front-face winding (<code>GCM_FRONTFACE_CW</code>), and draw every reflectable opaque mesh upside down below the floor.</li>
+ <li><b>Composite:</b> clear only depth (<code>GCM_CLEAR_Z</code>), turn the stencil off, and draw the glossy floor over it with alpha <code>1 − reflectivity</code>, then the upright scene.</li>
+ </ol>
</section>
<section id="bugs">
- <span class="num">06</span>
- <h2>Five bugs</h2>
- <p>The toolchain ran on an Apple-silicon Mac (PSL1GHT in a Docker image, Rust for <code>powerpc64</code>), and every one of these happened on the console. If you write for the RSX, they may save you some days.</p>
-
- <h3>1 · Every fragment uniform was zero</h3>
- <p>The first three.js frame showed a sharp PocketJS overlay over a black screen. Disassembling PSL1GHT’s prebuilt <code>rsxSetFragmentProgramParameter</code> in <code>librsx.a</code> showed the value argument copied into a register that is overwritten before it is used, and a zeroed 16-byte stack buffer passed to <code>rsxInlineTransfer</code> instead: every fragment uniform, exposure and every light included, was uploaded as zeros. Our reading is that GCC 13 optimized the copy away under strict aliasing. A twelve-line replacement that copies with <code>memcpy</code> and calls <code>rsxInlineTransfer</code> itself fixed it.</p>
- <pre class="code"> 48: mr r28, r6 # r28 = the value
- d0: mr r28, r3 # overwritten before it is read
- 104: addi r5, r1, 112 # the zeroed stack buffer
+ <span class="num">05</span>
+ <h2>Five wild hardware and toolchain bugs</h2>
+ <p>Getting pixels onto a 20-year-old console from an Apple-silicon Mac (PSL1GHT in the <code>hldtux/ps3dev</code> Docker image, plus Rust nightly for <code>powerpc64-sony-ps3</code>) was half graphics programming and half detective work. Every one of these happened on real hardware—and if you ever hack on the RSX, this list may save you days.</p>
+
+ <h3>1 · The GCC 13 strict-aliasing ghost in <code>librsx.a</code></h3>
+ <p>On the very first Three.js boot, the PocketJS HUD rendered razor-sharp—and the 3D background was <b>pure <code>#000000</code></b>. We disassembled PSL1GHT’s prebuilt <code>rsxSetFragmentProgramParameter</code> inside <code>librsx.a</code> with <code>ppu-objdump -dr</code> and stared in disbelief:</p>
+ <pre class="code"> 18: std r11, 112(r1) # zero-init 16 bytes on the stack
+ 20: std r10, 120(r1)
+ 48: mr r28, r6 # r28 = the value (never read!)
+ d0: mr r28, r3 # overwritten before it is copied
+ 104: addi r5, r1, 112 # passes the zeroed buffer
110: bl rsxInlineTransfer</pre>
+ <p><b>Every fragment uniform we set was uploading <code>(0, 0, 0, 0)</code> into VRAM</b>—exposure, sky colours, every light intensity. Our best reading: <code>ppu-gcc</code> 13.2.0 optimized the copy away under strict aliasing. Replacing it with our own 12-line <code>memcpy</code>-based <code>set_fp_vec4()</code> over <code>rsxInlineTransfer</code> fixed it immediately.</p>
+
+ <h3>2 · <code>cgcomp -a -v</code> ignores write masks on <code>o[HPOS]</code></h3>
+ <p>With fragment uniforms fixed, the sky lit up—and <b>zero 3D triangles</b> appeared. Dumping the compiled vertex microcode of <code>pbr3d.vp</code> found the culprit in two seconds:</p>
+ <pre class="code">DP4 o[HPOS].x, v[0], c[0]; -&gt; 6041ff80 (mask = XYZW!)
+DP4 o[HPOS].y, v[0], c[1]; -&gt; 6041ff80 (mask = XYZW!)
+DP4 o[HPOS].z, v[0], c[2]; -&gt; 6041ff80 (mask = XYZW!)
+DP4 o[HPOS].w, v[0], c[3]; -&gt; 6041ff80 (mask = XYZW!)</pre>
+ <p>The vertex assembler ignores component write masks on output registers! All four <code>DP4</code>s wrote the full <code>.xyzw</code>, so every vertex in the universe collapsed to <code>(w, w, w, w)</code>. Computing into <code>R0.x</code> … <code>R0.w</code> first and finishing with <code>MOV o[HPOS], R0</code> produced distinct write masks—and the golden torus knot exploded onto the 1080p screen on the next deploy.</p>
+
+ <h3>3 · <code>cgcomp -a -f</code> drops <code>SUB</code>, <code>ABS</code> and inline literals</h3>
+ <p>We wrote raw <code>!!FP2.0</code> for <code>cgcomp -a -f</code> (NVIDIA’s Cg compiler doesn’t run on ARM64 Linux), and inspecting the compiled <code>.fpo</code> binaries turned up four undocumented traps:</p>
+ <ul>
+ <li><code>SUB R0, R1, R2;</code> assembles to a <b>16-byte all-zero no-op</b>—write <code>ADD R0, R1, -R2;</code></li>
+ <li><code>ABS R0, R1;</code> is <b>silently dropped</b>—use the modifier, <code>MOV R0, |R1|;</code></li>
+ <li>Inline literals like <code>{14.0}.x</code> are <b>read as <code>R0</code></b>—put every number in a named constant (<code>uK0</code> … <code>uK4</code>)</li>
+ <li>A blank line inside <code>!!FP2.0</code> <b>segfaults the assembler</b></li>
+ </ul>
- <h3>2 · Every vertex landed on one point</h3>
- <p>With uniforms fixed the sky appeared, and no triangle did. The vertex assembler (<code>cgcomp -a -v</code>) ignores write masks on output registers: four <code>DP4 o[HPOS].x/.y/.z/.w</code> each assembled to a full <code>.xyzw</code> write, so every vertex became <code>(w, w, w, w)</code>. Computing into <code>R0.x</code> to <code>R0.w</code> and ending with <code>MOV o[HPOS], R0</code> fixed it.</p>
-
- <h3>3 · The fragment assembler drops what it does not know</h3>
- <p><code>cgcomp -a -f</code>, used because NVIDIA’s Cg compiler does not run on ARM64 Linux, turned <code>SUB</code> into a 16-byte no-op (write <code>ADD R0, R1, -R2</code>), dropped <code>ABS</code> (write <code>MOV R0, |R1|</code>), read inline literals such as <code>{14.0}.x</code> as <code>R0</code> (put every number in a named constant), and crashed on a blank line.</p>
-
- <h3>4 · The camera that never moved</h3>
- <p><code>camera.updateMatrixWorld()</code> does not update <code>camera.matrixWorldInverse</code>; <code>WebGLRenderer.render()</code> does, with <code>matrixWorldInverse.copy(matrixWorld).invert()</code>. A custom renderer that skips that line draws from the origin, looking down −Z, wherever the camera is.</p>
+ <h3>4 · The classic custom-renderer trap: <code>camera.matrixWorldInverse</code></h3>
+ <p>In Three.js, <code>camera.updateMatrixWorld()</code> updates <code>camera.matrixWorld</code>, <b>not</b> <code>camera.matrixWorldInverse</code>. <code>WebGLRenderer.render()</code> is the one that calls:</p>
+ <pre class="code js">camera.matrixWorldInverse.copy(camera.matrixWorld).invert();</pre>
+ <p>Forget that one line in a custom renderer and your camera stays stuck at the origin looking down −Z, no matter where you orbit it.</p>
- <h3>5 · Off the end of the ring</h3>
- <p>The instanced demo with 400 instances locked the RSX on its first frame. Each instance writes about 58 words (its constants and a draw), and 400 of them are about 92 KB, past the end of the FIFO segment. Two fixes: the driver rewinds the ring after every frame, and <code>rsx3d.c</code> checks for space before a batch and rewinds in the middle of a frame when it must. The demo also went to 196 instances (14 × 14), and the point lights’ <code>POW</code> became repeated squaring, which freed three registers in the PBR program.</p>
+ <h3>5 · The FIFO wall, and tuning for the NV40</h3>
+ <p>Switching to the instanced demo—then 400 instances in one <code>InstancedMesh</code>—froze the RSX on frame one. Why? Each instance emits about 58 FIFO words (a constant-block load of 12 <code>vec4</code>s plus a draw), so <code>400 × 58 = 23,200</code> words, about 92 KB, blew straight past the end of PSL1GHT’s command segment mid-frame. We fixed it on both ends:</p>
+ <ul>
+ <li><b>Safety:</b> <code>rsx_driver.c</code> rewinds the FIFO to its start after every frame, and an <code>ensure_fifo_space()</code> guard in <code>rsx3d.c</code> rewinds mid-frame, so an arbitrarily large batch can never hang the GPU.</li>
+ <li><b>Speed:</b> the point lights’ <code>POW</code> (<code>LG2 + MUL + EX2</code>) became repeated squaring (s² → s⁴ → s⁸ → s¹⁶), <code>pbr3d.fp</code> went from 16 to 13 registers so the NV40 keeps more fragments in flight, the demo writes <code>instanceMatrix.array</code> directly instead of calling <code>Object3D.updateMatrix()</code> per instance, and the wave became a 14 × 14 grid of 196 pillars.</li>
+ <li><b>Point sprites:</b> adding <code>MOV o[TEX0], v[0];</code> to <code>unlit3d.vp</code> put <code>TEX0</code> in the vertex output mask, so the hardware’s <code>GCM_POINT_SPRITE_TEX0</code> coordinates finally reached <code>unlit3d.fp</code>—and all 2,400 galaxy stars and 260 showroom embers lit up.</li>
+ </ul>
</section>
- <section id="measured">
- <span class="num">07</span>
- <h2>What it measured</h2>
- <p>Each frame below was read at 1920 × 1080 from the RSX’s front buffer over the DevShell, a TCP service on port 8623 that also reloads the app’s bundle in place and injects controller input, so we never went back to the console’s menu while working.</p>
+ <section id="results">
+ <span class="num">06</span>
+ <h2>Live 1080p results on real PS3 hardware</h2>
+ <p>Every frame below was captured natively at <b>1920 × 1080</b> from the RSX front buffer over our closed-loop DevShell on TCP <code>:8623</code>—which also hot-reloads app bundles in place without ever exiting to the XMB, and injects DualShock 3 input from the terminal.</p>
<div class="grid4">
- <figure><img src="../../media/ps3/showroom-800.webp" width="800" height="450" alt="The showroom: a gold torus knot over a mirrored floor" loading="lazy" decoding="async"><figcaption><b>Showroom</b> 25,990 triangles · 26 draws · planar mirror · <b>20 fps</b></figcaption></figure>
- <figure><img src="../../media/ps3/instanced.webp" width="1600" height="900" alt="The instanced wave: 196 metallic pillars in a grid" loading="lazy" decoding="async"><figcaption><b>Instanced wave</b> 196 instances · 199 draws · 28.9 ms to write them · <b>16 fps</b></figcaption></figure>
- <figure><img src="../../media/ps3/galaxy.webp" width="1600" height="900" alt="A planet with rings in front of a spiral galaxy of 2,400 points" loading="lazy" decoding="async"><figcaption><b>Galaxy</b> 5,678 triangles · 2,400 point sprites · 7 draws · <b>30 fps</b></figcaption></figure>
- <figure><img src="../../media/ps3/pbr-grid.webp" width="1600" height="900" alt="Twenty spheres from smooth to rough and from dielectric to metal" loading="lazy" decoding="async"><figcaption><b>Material grid</b> 58,886 triangles · 43 draws · mirror · <b>26 fps</b></figcaption></figure>
+ <figure><img src="../../media/ps3/showroom-800.webp" width="800" height="450" alt="The chrome and gold PBR showroom: a gold torus knot over a mirrored floor" loading="lazy" decoding="async"><figcaption><b>Chrome &amp; gold PBR showroom</b> 25,990 triangles · 26 draws · stencil mirror · <b>20 fps</b></figcaption></figure>
+ <figure><img src="../../media/ps3/instanced.webp" width="1600" height="900" alt="The instanced kinetic wave: 196 metallic pillars in a grid" loading="lazy" decoding="async"><figcaption><b>Instanced kinetic wave</b> 196 InstancedMesh pillars · per-instance colour · LineLoop · <b>16 fps</b></figcaption></figure>
+ <figure><img src="../../media/ps3/galaxy.webp" width="1600" height="900" alt="A ringed planet in front of a spiral galaxy of 2,400 points" loading="lazy" decoding="async"><figcaption><b>Exoplanet &amp; 2,400-star galaxy</b> DataTexture planet and rings · point sprites · <b>30 fps</b></figcaption></figure>
+ <figure><img src="../../media/ps3/pbr-grid.webp" width="1600" height="900" alt="Twenty spheres from smooth to rough and from dielectric to metal" loading="lazy" decoding="async"><figcaption><b>PBR material matrix</b> 58,886 triangles · 5 × 4 roughness × metalness · mirror · <b>26 fps</b></figcaption></figure>
</div>
- <p>None of them reaches 60. In three of the four, writing the 3D commands takes 0.1 ms, so most of the frame goes somewhere we have not measured yet: QuickJS walking the scene on the PPU, the RSX shading two million pixels of PBR (twice, where there is a mirror), or waiting for vsync. That profile is the next piece of work, and then the SPUs.</p>
- <p>With a DualShock 3: <code>L1</code> and <code>R1</code> change the scene, the sticks orbit and zoom, <code>△</code> shows wireframe, <code>○</code> turns the mirror off and on, <code>□</code> stops the orbit, <code>SELECT</code> hides the overlay.</p>
+ <p>With a DualShock 3 in hand: <code>L1</code> / <code>R1</code> switch scenes, the sticks orbit and zoom, <code>△</code> toggles hardware wireframe, <code>○</code> toggles the mirror, <code>□</code> pauses the orbit, and <code>SELECT</code> hides the HUD for a clean full-screen 1080p view.</p>
+ <p>None of these hits 60 fps yet. In three of the four, writing the 3D commands takes about 0.1 ms, so most of each frame goes somewhere we haven’t measured yet: QuickJS walking the scene on the PPU, the RSX shading two million PBR pixels (twice where there’s a mirror), or waiting on vsync. Profiling that is next.</p>
+ <p>And the work hasn’t stopped at these captures: the Cell’s six SPUs now run marching cubes and particles, and a second app flies through ThreeRT’s own <b>Bistro</b> and <b>Zero-Day</b>—baked offline into a PS3 scene format, rendered at 720p and scaled to 1080p—at <b>29–30 fps</b>. That code is in <a href="https://github.com/pocket-nexus/pocketjs/pull/786" rel="noopener">pocket-nexus/pocketjs#786</a>.</p>
</section>
<section id="threert">
- <span class="num">08</span>
- <h2>What it means for ThreeRT</h2>
- <p>ThreeRT is a native runtime for three.js: no browser between your scene and the GPU. How much of three.js stays depends on the machine. On macOS and Linux, <code>webgpu</code> keeps all of it, three.js and its own <code>WebGPURenderer</code>, and replaces only the browser: a 9.9 MB app where Electron takes 445 MB. On GPUs with ray-tracing hardware, <code>path</code> replaces the renderer with a path tracer at 60 fps. The PS3 is the third case. It has no WebGPU and no JIT, so three.js keeps its scene graph and a native renderer draws it.</p>
- <p>The PS3 port is experimental, and it is built in PocketJS (<code>platforms/ps3</code>), not by ThreeRT’s tools. What it shows is how little a three.js scene needs from a machine once the browser is gone. How the three ways differ is in <a href="https://github.com/meshy-dev/ThreeRT/blob/main/docs/RENDERING-METHODS.md#native-scene-graph-renderers" rel="noopener">RENDERING-METHODS.md</a>.</p>
+ <span class="num">07</span>
+ <h2>Why this matters for ThreeRT: RT means runtime</h2>
+ <p>At first glance, running Three.js r187 on a 2006 PlayStation 3 sounds like a fun weekend stunt. In the context of <a href="../../">ThreeRT</a>, it is the <b>boundary proof</b> of a much bigger idea.</p>
+ <p>ThreeRT started as a hardware path tracer and has grown into a <b>native runtime for Three.js</b>—no browser between your scene and the GPU:</p>
+ <ul>
+ <li><b><code>path</code>:</b> real-time path tracing at 60 fps on GPUs with ray-tracing hardware, nothing baked.</li>
+ <li><b><code>webgpu</code>:</b> Three.js r187 and its own <code>WebGPURenderer</code>, unchanged, running natively on macOS and Linux—a desktop app at <b>9.9 MB installed, 4.5 MB to download</b>—and surfaces a browser simply can’t be, like a live 3D <b>Wayland wallpaper</b> on Omarchy (<a href="https://github.com/meshy-dev/ThreeRT/pull/300" rel="noopener">#300</a>).</li>
+ </ul>
+ <p>The PS3 completes the spectrum:</p>
+ <div class="tbl">
+ <table>
+ <thead><tr><th>Tier</th><th>How it runs</th><th>Hardware &amp; API</th><th>What it proves</th></tr></thead>
+ <tbody>
+ <tr><th>Flagship RT</th><td><code>path</code></td><td>Apple silicon, RTX, RDNA2+ (wgpu ray queries)</td><td>real-time path tracing with zero baking</td></tr>
+ <tr><th>Modern native</th><td><code>webgpu</code></td><td>Metal on macOS, Vulkan on Linux (wgpu + JavaScriptCore + PocketJS)</td><td>sub-10 MB native apps and OS surfaces, with the same pixels as Chrome</td></tr>
+ <tr class="hot"><th>Console / legacy GPU</th><td>the PS3 port <small>PocketJS, experimental</small></td><td>2006 PlayStation 3: NV40-class RSX, raw FIFO, NV40 assembly, QuickJS</td><td><b>no browser, no Electron, no WebGPU, no Vulkan, no JIT—still vanilla Three.js r187</b></td></tr>
+ </tbody>
+ </table>
+ </div>
+ <p>If vanilla <code>[email protected]</code> can drive real-time PBR, studio IBL and hardware-stenciled mirror reflections on a 20-year-old PlayStation 3 at 1080p, there is no reason Three.js has to stay trapped inside a browser tab ever again.</p>
+ <p class="fine">The PS3 port is experimental, needs a console with custom firmware, and is built in PocketJS (<code>platforms/ps3</code>). How the three ways of running differ: <a href="https://github.com/meshy-dev/ThreeRT/blob/main/docs/RENDERING-METHODS.md#native-scene-graph-renderers" rel="noopener">RENDERING-METHODS.md</a>.</p>
<div class="acts"><a class="btn primary" href="../../"><span>three.js, down to the metal</span></a><a class="btn ghost" href="https://github.com/meshy-dev/ThreeRT" rel="noopener"><span>ThreeRT on GitHub</span></a></div>
</section>
</main>