Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Image to 3D: the splat viewer keeps drawing while a splat settles, with its browser check and the renderer choice in the research

Claudecff844ddfa8e
diff --git a/docs/research/idol-9.json b/docs/research/idol-9.json
index 043dac31..1b1a09c4 100644
--- a/docs/research/idol-9.json
+++ b/docs/research/idol-9.json
@@ -708,6 +708,7 @@
"handBuiltGraph": "scripts/comfy/hand-built/image-to-splat-triposplat.json: 99 LoadImage, 88:35 cut-out switch, 88:2 TripoSplatPreprocessImage, 88:24 TripoSplatConditioning, 88:16 UNETLoader, 88:6 KSampler (20, 3, dpmpp_2m/simple), 88:11 VAELoader, 88:55 VAEDecodeTripoSplat, 92 SplatToFile3D spz, 51 SaveGLB, 79 CreateCameraInfo, 75 RenderSplat (opacity_threshold 0), 41 CreateVideo, 42 SaveVideo",
"library": "scripts/comfy/library.spec.mjs CUSTOM_NODE_REPOS L124, PACK_CLASSES L156, KNOWN_MODELS L164 (birefnet L168, flux2-vae L230, dino_v3_vit_h L273, TripoSplat L274-275), entry L3349; BINDING_KEYS scripts/comfy/build-library.mjs L98-135",
"viewers": "GLB via @google/model-viewer 4.3.1 (package.json L35); three 0.183.2 (L56) for Cinema; no splat renderer (result-media.tsx L248, model-card.tsx L177)",
+ "splatViewer": "idol-4 (2026-11-03): @sparkjsdev/spark 2.3.1 (MIT, World Labs, published 2026-10-01; peer three >=0.180.0; .spz/.ply/.ksplat/.splat; WebGL2; 0.92 MB gzipped, dynamic import only) chosen over @mkkellogg/gaussian-splats-3d 0.4.7 (MIT, last release 2025-01-25, no .spz). Phone frame time unmeasured (SwiftShader here: ~8 s per frame at 262,144). Haze cut-off starts at 0.05 for Idol 3D, 0 for TripoSplat.",
"canvas": "canvas.ts KIND_OP model3d -> image-to-3d (L404); splat takes images (L516); modelChoices L434; sliders on nodes (canvas/nodes.tsx L627)",
"outputActions": "image next steps animate, upscale, edit (output-actions.ts L169-170); model3d 'View in 3D' (L146); no 3D action on images",
"nameClash": "apps.ts L1486 'Idol' K-pop video app (higgsfield-inventory.md L414)",
diff --git a/docs/research/idol-9.md b/docs/research/idol-9.md
index 0780b42e..745c2d36 100644
--- a/docs/research/idol-9.md
+++ b/docs/research/idol-9.md
@@ -236,7 +236,7 @@ Fuobe's existing cloud TripoSplat in Splat mode (`triposplat`, fal `tripo3d/trip
- **Splat:** cloud `triposplat` ("The subject as a .ply splat · ≈ $0.05"); open `oss-triposplat` ("The subject as a .spz splat + an orbit video · 8 GB GPU · MIT", L57).
- `CLOUD_NOTICES` adds "Built with DINOv3" to cloud TripoSplat and TRELLIS.2 (L67). The studio's hint under the button names TripoSplat by hand (`model3d-studio.tsx` L314–320).
- **The open model** `oss-triposplat` (`src/lib/catalog/models.ts` L1380): route `comfy('splat', 'image-to-splat-triposplat')`, a `numGaussians` slider 32,768–1,048,576. Its manifest entry (`workflows/comfyui/manifest.json` L15453) is pinned to ComfyUI 0.41.0 (`fc04da91`): defaults steps 20, cfg 3, 262,144 Gaussians, 75 orbit frames, `.spz`, cut-out on; `vramGb` 8, "VRAM unverified. Validated by /prompt only."
-- **Viewers.** GLBs show in `@google/model-viewer` 4.3.1 (`package.json` L35). three 0.183.2 (L56) drives Cinema's scene viewer. **Fuobe does not draw splats**: `result-media.tsx` L248 and `model-card.tsx` L177 say so and point to SuperSplat.
+- **Viewers.** GLBs show in `@google/model-viewer` 4.3.1 (`package.json` L35). three 0.183.2 (L56) drives Cinema's scene viewer. **Fuobe does not draw splats**: `result-media.tsx` L248 and `model-card.tsx` L177 say so and point to SuperSplat. *(Since idol-4, 2026-11-03: it does, with Spark; see §9 idol-4.)*
- **Elsewhere.** Canvas: `model3d` nodes default to op `image-to-3d` (`canvas.ts` L404); `splat` takes images (L516); the tile is `canvas/nodes.tsx` L469–472. Feed: image next steps are animate, upscale, edit (`output-actions.ts` L169–170), no 3D action; 3D outputs get "View in 3D" (L146). Library: a 3D tab (`library-view.tsx` L58). Licences: `src/lib/licences.ts` builds rows from the manifest and `NODE_PACKS` (from L406).
- **Name clash.** `src/lib/catalog/apps.ts` L1486 already ships a video app called **"Idol"** ("Become a K-pop idol on stage"), mirroring a Higgsfield effect (`higgsfield-inventory.md` L414). The 3D model needs another name in pickers, ⌘K, the Library and Settings: **"Idol 3D"**.
- **The local ComfyUI** (`127.0.0.1:8188`): v0.41.0, CPU only, 14.3 GB RAM. It has every stock TripoSplat and splat node. The `diffusion_models`, `vae`, `clip_vision` and `background_removal` folders are empty, so nothing 3D can run there; only `/prompt` validation.
@@ -312,6 +312,32 @@ A `splat` suite in `scripts/eval/cases/splat.json`, kind `video` (the orbit vide
A lazily loaded three.js Gaussian-splat viewer for `.spz` / `.ply` / `.ksplat` in `model-card.tsx`, `studio/result-media.tsx` and the Library's 3D tab, replacing "Fuobe doesn't draw splats yet". Orbit, zoom, reset, an opacity cut-off (default 0.05 for Idol), "Save a still" to the Library; the orbit video stays as the poster and the fallback. The library choice (Spark or GaussianSplats3D, say) is a guess and needs its own check of licence, version, `.spz` support and phone performance. Works for TripoSplat results on both engines.
+**Built (2026-11-03): Spark 2.3.1.** The two candidates, checked at npm and in the packages themselves:
+
+| | Spark (`@sparkjsdev/spark`) | GaussianSplats3D (`@mkkellogg/gaussian-splats-3d`) |
+|---|---|---|
+| Licence | MIT (© 2025 World Labs Technologies) | MIT |
+| Version | 2.3.1, published 2026-10-01 (2.4.0 of 2026-10-20 was 14 days old: too new) | 0.4.7, 2025-01-25, no release since |
+| three | peer `>=0.180.0` (Fuobe has 0.183.2) | peer `>=0.160.0` |
+| `.spz` | yes (its README; Fuobe's demo `.spz` v2 parses, see below) | no (`.ply`, `.splat`, `.ksplat` only, its README) |
+| `.ply`, degree-0 SH | yes (Idol's 17-float layout parses) | yes |
+| `.ksplat` | yes | yes (its own format) |
+| WebGL2 | yes ("targeting 98%+ WebGL2 support") | yes |
+| Bundle | `spark.module.min.js` 2.60 MB, **0.92 MB gzipped** (the Rust/WASM core is inlined as base64); one dependency, `fflate` | not measured (ruled out on `.spz`) |
+| Per-splat opacity cut-off | a `dyno` object modifier (the viewer's "Hide faint haze", live); `transcodeSpz` also takes `opacityThreshold` | `splatAlphaRemovalThreshold` at load only (0-255) |
+
+Spark loads only through a dynamic import (`src/components/model3d/splat-engine.ts`, from `splat-viewer.tsx`); `tests/splat-view.test.ts` checks that nothing else imports it, and `tests/e2e/splat-viewer.mjs` that a page without a splat never fetches it (matched by its WASM glue's module name, so it holds for hashed production chunks too).
+
+Numbers measured here (this container: 4 CPUs, no GPU; Chromium's WebGL2 runs on SwiftShader, a software renderer):
+
+- **Parsing.** Spark's own decoder (`transcodeSpz`, in Node) reads the demo `.ply` and `.spz` (4,096 Gaussians, 1,280 of them haze) to the same 4,096, positions identical to the bit and v2 rotations identical; with `opacityThreshold` 0.05 it keeps 2,816, the solid ones.
+- **Sizes at 262,144 Gaussians** (`node scripts/gen-demo-splat.mjs --gaussians=262144`): `.ply` 17,826,208 bytes (matches §2.1's 17.8 MB), `.spz` v2 2,770,631 bytes (6.4×; real splats compress less than this synthetic one, guess).
+- **Load.** The 17.8 MB `.ply` from the local server to the toolbar showing: 1.6 s at 390 px (fetch, parse, upload).
+- **Frame time: not measured on a phone.** SwiftShader takes about 8 s per frame at 262,144 Gaussians (median of 51 frames while dragging at 390 px), so software rendering says nothing about a phone's GPU. The 4,096-Gaussian demo draws within about 3 s of opening on SwiftShader. Measure on a real phone (an iPhone 12 / Pixel 6 class device, a 262,144-Gaussian `.spz`) before calling it fast; the viewer caps the pixel ratio at 1.5 on touch screens and draws only when something changes (a drag, the slider, Spark finishing a sort), never in a loop.
+- **Size limit.** The viewer opens files up to 48 MB on a touch screen (a 262,144-Gaussian `.ply` fits; a 1,048,576 one at 71 MB doesn't) and 160 MB elsewhere; past that the orbit video or picture stays, with the download.
+
+The cut-off starts at 0.05 for Idol 3D (both engines) and at 0 for TripoSplat, until the A/B (idol-3) says what TripoSplat's haze is. The orbit video stays as the fallback with no WebGL2, for a file over the limit, and with reduced motion in the full-screen viewer (until "Look around in 3D").
+
### idol-5 · "Make it 3D (quick)" on image results (P1)
A menu action on image results (`output-actions.ts`, `case "image"`) that opens `/image-to-3d?mode=splat&model=oss-idol&quality=quick&image=…` with the picture in the slot and the photo crop off. Shown only when the open engine is available (a new `ActionContext.openEngine`); `NEXT_STEPS.image` stays as it is. The studio learns `?image=` and `?quality=`. Copy says "tens of seconds on a consumer GPU", not 2 s.
@@ -346,7 +372,7 @@ Place an Idol splat in the MoGe scene viewer (`src/components/cinema/scene-viewe
- **The SDK route needs gated repos** (DINOv3 manual approval; FLUX.2-dev repo terms). Use the ComfyUI route and the ungated files.
- **URL drift.** `flux2-vae`'s URL works only through HF's rename redirect.
- **Scope.** One object, background removed. Not a scene model (MoGe stays for Cinema). The core photo crop is my analysis until checked.
-- **No splat viewer yet,** so "look around it" is an orbit video until idol-4 lands.
+- **No splat viewer yet,** so "look around it" is an orbit video until idol-4 lands. *(Landed 2026-11-03, Spark 2.3.1; phone frame time still unmeasured.)*
- **VRAM.** A 7.2 GB vendor peak rules out 6 GB GPUs; 8 GB is borderline and unmeasured in ComfyUI.
- **CPU and Apple.** Possible in principle through ComfyUI in fp32, but likely tens of minutes per object (guess). Don't call it quick on CPU-only installs.
- **ComfyUI API drift.** The pack relies on `comfy_api.latest` types and the TripoSplat code. Both are unchanged from 0.41.0 to 0.43.1. The core-only graph is the safer base.
@@ -366,7 +392,7 @@ Place an Idol splat in the MoGe scene viewer (`src/components/cinema/scene-viewe
- What format the project page's 0.4 / 3.2 / 12.2 MB file sizes are.
- How good `SplatToMesh` meshes and `RenderSplat` side views of Idol splats are.
- Whether Speridlabs, fal or Replicate will host Idol, and what comes after "v0.1".
-- Which three.js splat renderer and version Fuobe should adopt.
+- Which three.js splat renderer and version Fuobe should adopt. *(Answered: Spark 2.3.1, §9 idol-4. Still unknown: its frame time on phones.)*
## Sources (read 2026-10-30)
diff --git a/scripts/gen-demo-splat.mjs b/scripts/gen-demo-splat.mjs
index e65aef4b..16215250 100644
--- a/scripts/gen-demo-splat.mjs
+++ b/scripts/gen-demo-splat.mjs
@@ -5,6 +5,8 @@
* the open TripoSplat and Idol 3D graphs write). Like an Idol splat, about a third of its Gaussians are faint haze
* (opacity under 0.05) around the object, so the viewer's "Hide faint haze" slider has something to hide.
* Deterministic (a seeded generator). Run: node scripts/gen-demo-splat.mjs
+ * A bigger one to time the viewer with (not committed): --gaussians=262144 --out=/tmp/splat-262k (writes
+ * demo-splat.ply and .spz there).
*/
import fs from "node:fs";
import path from "node:path";
@@ -12,11 +14,13 @@ import { fileURLToPath } from "node:url";
import zlib from "node:zlib";
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
-const out = path.join(root, "public", "samples");
+const arg = (name) => process.argv.find((a) => a.startsWith(`--${name}=`))?.split("=")[1];
+const out = arg("out") ? path.resolve(arg("out")) : path.join(root, "public", "samples");
+fs.mkdirSync(out, { recursive: true });
-const SOLID = 2816;
-const HAZE = 1280;
-const N = SOLID + HAZE;
+const N = Number(arg("gaussians") ?? 4096);
+const SOLID = Math.round(N * (2816 / 4096));
+const HAZE = N - SOLID;
// mulberry32: the same file on every run.
let seed = 0x5d4bdb;
diff --git a/src/components/model3d/splat-engine.ts b/src/components/model3d/splat-engine.ts
index 8f536e01..c17c4a33 100644
--- a/src/components/model3d/splat-engine.ts
+++ b/src/components/model3d/splat-engine.ts
@@ -28,6 +28,8 @@ export class SplatEngine {
private cutoff = dyno.dynoFloat(0);
private home = { position: new THREE.Vector3(0, 0, 3), target: new THREE.Vector3() };
private frame = 0;
+ /** Keep drawing until then (performance.now()): Spark builds, sorts and uploads over a few frames after a change. */
+ private until = 0;
private disposed = false;
/** The last frame's CPU time in milliseconds (renderer.render), for the numbers in docs/research/idol-9.md. */
lastFrameMs = 0;
@@ -68,7 +70,7 @@ export class SplatEngine {
this.mesh = mesh;
this.scene.add(mesh);
this.frameObject(mesh.getBoundingBox(true));
- this.requestRender();
+ this.requestRender(1500);
return { splats: mesh.packedSplats?.numSplats ?? 0, bytes: bytes.byteLength };
}
@@ -126,7 +128,7 @@ export class SplatEngine {
setCutoff(value: number) {
this.cutoff.value = value;
this.mesh?.updateVersion();
- this.requestRender();
+ this.requestRender(500);
}
setBackground(color: string) {
@@ -149,13 +151,16 @@ export class SplatEngine {
return new Promise((resolve, reject) => this.canvas.toBlob((b) => (b ? resolve(b) : reject(new Error("Couldn't save the still"))), "image/png"));
}
- private requestRender() {
+ /** Draw on the next frame, and keep drawing for `settleMs` (Spark finishing its work), or while the camera glides. */
+ private requestRender(settleMs = 150) {
+ this.until = Math.max(this.until, performance.now() + settleMs);
if (this.frame || this.disposed) return;
this.frame = requestAnimationFrame(() => {
this.frame = 0;
this.render();
// Damping keeps the camera gliding after a drag: keep drawing until it settles.
- if (this.controls.update()) this.requestRender();
+ const gliding = this.controls.update();
+ if (gliding || performance.now() < this.until) this.requestRender(0);
});
}
diff --git a/tests/e2e/splat-viewer.mjs b/tests/e2e/splat-viewer.mjs
new file mode 100644
index 00000000..f791fb85
--- /dev/null
+++ b/tests/e2e/splat-viewer.mjs
@@ -0,0 +1,273 @@
+// Looking around splats (idol-4) in a real browser (the app must be running in demo mode).
+// Usage: node tests/e2e/splat-viewer.mjs [appUrl] [--shots=dir]. Exits 1 on any failure.
+//
+// Demo splats are real files (public/samples/demo-splat.spz and .ply). At 1440 px and 390 px, in light and dark: on
+// Image to 3D → Splat, "View in 3D" opens the splat viewer on the card (an .spz from the open engine, a .ply from the
+// cloud), the toolbar's controls are labelled and work from the keyboard, "Hide faint haze" starts at 0.05 for
+// Idol 3D and Off for TripoSplat; the Library's 3D tab opens a splat full screen with the haze slider and the
+// download. Nothing scrolls sideways; no page errors or console errors. Bundle check: a page with no splat never
+// fetches Spark; opening a splat does.
+import assert from "node:assert/strict";
+import fs from "node:fs";
+import path from "node:path";
+import sharp from "sharp";
+import { DESKTOP, PHONE, launch } from "./_browser.mjs";
+
+const args = process.argv.slice(2);
+const app = (args.find((a) => !a.startsWith("--")) ?? "http://localhost:3000").replace(/\/$/, "");
+const shots = args.find((a) => a.startsWith("--shots="))?.slice(8);
+if (shots) fs.mkdirSync(shots, { recursive: true });
+const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
+const step = (name) => console.log(`- ${name}`);
+async function call(url, method = "GET", data) {
+ const res = await fetch(app + url, {
+ method,
+ headers: { "Content-Type": "application/json" },
+ ...(data !== undefined && { body: JSON.stringify(data) }),
+ });
+ return res.json();
+}
+async function until(fn, what, ms = 90_000) {
+ const t = Date.now();
+ for (;;) {
+ const v = await fn();
+ if (v) return v;
+ if (Date.now() - t > ms) throw new Error(`Timed out waiting for ${what}`);
+ await sleep(700);
+ }
+}
+
+const status = await call("/api/status");
+assert.notEqual(status.demoMode, "off", "run the app in demo mode (FUOBE_DEMO_MODE=on)");
+
+// A photo and three demo splats of it: TripoSplat on the open engine (.spz + orbit video), on the cloud (.ply), and
+// Idol 3D on the open engine (.spz, the haze slider at 0.05).
+const photo = await (
+ await fetch(`${app}/api/uploads`, {
+ method: "POST",
+ headers: { "content-type": "image/jpeg", "x-file-name": "figure.jpg" },
+ body: fs.readFileSync(path.resolve("public/previews/presets/app-3d-figure.jpg")),
+ })
+).json();
+assert.ok(photo.url, `an upload: ${JSON.stringify(photo).slice(0, 200)}`);
+const made = {};
+for (const modelId of ["oss-triposplat", "triposplat", "oss-idol"]) {
+ const r = await call("/api/generations", "POST", {
+ feature: "image-to-3d",
+ modelId,
+ op: "splat",
+ inputs: { images: [photo.url] },
+ });
+ const g = r.items?.[0];
+ assert.ok(g, `a demo splat from ${modelId}: ${JSON.stringify(r).slice(0, 300)}`);
+ made[modelId] = await until(async () => {
+ const d = await call(`/api/generations/${g.id}`);
+ return d.status === "succeeded" && d;
+ }, `the ${modelId} splat`);
+ const mesh = made[modelId].outputs.find((o) => o.kind === "model3d");
+ assert.match(mesh.url, modelId === "triposplat" ? /\.ply$/ : /\.spz$/, `${modelId}: a real splat file`);
+}
+
+// Chromium draws WebGL2 through SwiftShader when there's no GPU.
+const browser = await launch({
+ args: ["--enable-unsafe-swiftshader", "--use-angle=swiftshader", "--ignore-gpu-blocklist"],
+});
+const failures = [];
+
+async function context(phone, scheme) {
+ const ctx = await browser.newContext({
+ ...(phone ? PHONE : DESKTOP),
+ colorScheme: scheme,
+ });
+ await ctx.addInitScript(() => {
+ localStorage.setItem("fuobe.engine", "both");
+ document.addEventListener("DOMContentLoaded", () => {
+ const s = document.createElement("style");
+ s.textContent = "nextjs-portal{display:none!important}";
+ document.head.append(s);
+ });
+ });
+ const page = await ctx.newPage();
+ const spark = [];
+ // Spark's script, by name (a dev build) or by what's inside it (a production chunk's name is a hash): its WebAssembly
+ // glue's module name survives minifying.
+ page.on("response", async (r) => {
+ if (r.request().resourceType() !== "script") return;
+ if (/sparkjsdev|splat-engine/.test(r.url())) return void spark.push(r.url());
+ const body = await r.text().catch(() => "");
+ if (body.includes("spark_rs_bg")) spark.push(r.url());
+ });
+ const tag = `${phone ? "phone" : "desktop"} ${scheme}`;
+ page.on("pageerror", (e) => failures.push(`${tag}: page error ${e.message}`));
+ page.on("console", (m) => m.type() === "error" && !/Failed to load resource/.test(m.text()) && failures.push(`${tag}: console ${m.text().slice(0, 300)}`));
+ return { ctx, page, spark, tag };
+}
+const noSideScroll = async (page, what) =>
+ assert.equal(await page.evaluate(() => document.documentElement.scrollWidth - window.innerWidth), 0, `${what}: nothing scrolls sideways`);
+const shoot = (page, name) => shots && page.screenshot({ path: path.join(shots, `${name}.png`) });
+/** The viewer has drawn something besides its background (a splat is on screen): a screenshot of its canvas. */
+async function drawn(locator) {
+ const png = await locator.screenshot();
+ const { data, info } = await sharp(png).raw().toBuffer({ resolveWithObject: true });
+ const [r, g, b] = [data[0], data[1], data[2]];
+ let differ = 0;
+ // The top two thirds: the toolbar sits at the bottom.
+ const end = Math.floor(info.height * 0.66) * info.width * info.channels;
+ for (let i = 0; i < end; i += info.channels * 4) if (Math.abs(data[i] - r) + Math.abs(data[i + 1] - g) + Math.abs(data[i + 2] - b) > 40) differ++;
+ return differ > 200;
+}
+
+for (const phone of [false, true]) {
+ for (const scheme of ["light", "dark"]) {
+ const { ctx, page, spark, tag } = await context(phone, scheme);
+ const name = `${phone ? "390" : "1440"}-${scheme}`;
+ try {
+ // Bundle check: a page with no splat never fetches Spark.
+ step(`${tag}: Image (no splat) loads no splat renderer`);
+ await page.goto(`${app}/image`, { waitUntil: "load" });
+ await sleep(1500);
+ assert.deepEqual(spark, [], `${tag}: Spark fetched on a page without a splat`);
+
+ step(`${tag}: Image to 3D → Splat, the cards`);
+ await page.goto(`${app}/image-to-3d?mode=splat`, { waitUntil: "load" });
+ const cards = page.locator("#your-3d-models article");
+ await cards.first().waitFor({ timeout: 30_000 });
+ await sleep(800);
+ await noSideScroll(page, `${tag} cards`);
+ assert.deepEqual(spark, [], `${tag}: Spark fetched before a splat was opened`);
+ assert.equal(await page.getByText("doesn't draw splats", { exact: false }).count(), 0, `${tag}: the old note is gone`);
+
+ for (const [modelId, cutoff] of [
+ ["oss-idol", "5%"],
+ ["triposplat", "Off"],
+ ]) {
+ const g = made[modelId];
+ const card = cards.filter({ hasText: g.modelName ?? modelId }).first();
+ await card.scrollIntoViewIfNeeded();
+ // The download stays.
+ const ext = modelId === "triposplat" ? "ply" : "spz";
+ assert.equal(await card.getByRole("link", { name: `.${ext}` }).count(), 1, `${tag} ${modelId}: the .${ext} download`);
+ await card.getByRole("button", { name: "View in 3D" }).click();
+ const toolbar = card.getByRole("toolbar", { name: "3D view" });
+ await toolbar.waitFor({ timeout: 60_000 });
+ assert.ok(spark.length > 0, `${tag}: opening a splat fetches Spark`);
+ const stage = card.getByRole("application", { name: /Look around/ });
+ await until(() => drawn(stage.locator("canvas")), `${tag} ${modelId}: the splat drawn`, 30_000);
+ // Focus went to the viewer; the keyboard turns and zooms it, 0 resets.
+ assert.equal(await stage.evaluate((el) => document.activeElement === el), true, `${tag} ${modelId}: the viewer has the focus`);
+ for (const k of ["ArrowLeft", "ArrowUp", "+", "-", "0"]) await page.keyboard.press(k);
+ for (const label of ["Reset view", "Turn it over", "Light background", "Grey background", "Dark background", "Hide faint haze", "Save a still"]) {
+ assert.equal(
+ await toolbar
+ .getByRole(/background/.test(label) ? "radio" : "button", {
+ name: label,
+ })
+ .count(),
+ 1,
+ `${tag} ${modelId}: ${label}`,
+ );
+ }
+ await toolbar.getByRole("radio", { name: "Grey background" }).click();
+ assert.equal(await toolbar.getByRole("radio", { name: "Grey background" }).getAttribute("aria-checked"), "true");
+ await toolbar.getByRole("button", { name: "Hide faint haze" }).click();
+ const slider = page.getByRole("slider", { name: "Hide faint haze" });
+ await slider.waitFor();
+ assert.equal(
+ await page.locator("[data-slot=popover-content]").getByText(cutoff, { exact: true }).count(),
+ 1,
+ `${tag} ${modelId}: haze starts at ${cutoff}`,
+ );
+ await slider.focus();
+ await page.keyboard.press("ArrowRight");
+ await page.keyboard.press("Escape");
+ await noSideScroll(page, `${tag} ${modelId} viewer`);
+ await shoot(page, `${name}-card-${modelId}`);
+ // Save a still: the PNG goes to the uploads.
+ const uploads = async () => {
+ const r = await call("/api/assets?source=upload&limit=200");
+ return (Array.isArray(r) ? r : (r.items ?? r.assets ?? [])).length;
+ };
+ const before = await uploads();
+ await toolbar.getByRole("button", { name: "Save a still" }).click();
+ await page.getByText("Still saved to your Library").first().waitFor({ timeout: 20_000 });
+ await until(async () => (await uploads()) > before, `${tag}: the still in the uploads`, 10_000);
+ }
+
+ step(`${tag}: the Library's 3D tab opens a splat full screen`);
+ await page.goto(`${app}/library?tab=3d`, { waitUntil: "load" });
+ await sleep(1500);
+ await noSideScroll(page, `${tag} library 3d`);
+ // The newest 3D result: a demo splat made above.
+ await page
+ .getByRole("button", { name: /^Open “Gaussian splat/ })
+ .first()
+ .focus();
+ await page.keyboard.press("Enter");
+ const dialog = page.getByRole("dialog");
+ await dialog.getByRole("toolbar", { name: "3D view" }).waitFor({ timeout: 60_000 });
+ assert.equal(await dialog.getByRole("slider", { name: "Hide faint haze" }).count(), 1, `${tag}: the panel's haze slider`);
+ await until(() => drawn(dialog.getByRole("application").locator("canvas")), `${tag}: the panel's splat drawn`, 30_000);
+ assert.ok((await dialog.getByRole("link", { name: /^\.(spz|ply)$/ }).count()) >= 1, `${tag}: the panel's download`);
+ await noSideScroll(page, `${tag} library viewer`);
+ await sleep(1000);
+ await shoot(page, `${name}-panel`);
+ } catch (e) {
+ failures.push(`${tag}: ${e.message}`);
+ await shoot(page, `${name}-failure`);
+ }
+ await ctx.close();
+ }
+}
+
+// A GLB still opens in @google/model-viewer, and doesn't bring Spark in.
+{
+ step("a GLB result: model-viewer, no splat renderer");
+ const r = await call("/api/generations", "POST", { feature: "image-to-3d", modelId: "oss-pixal3d", op: "image-to-3d", inputs: { images: [photo.url] } });
+ const g = r.items?.[0];
+ assert.ok(g, "a demo GLB");
+ await until(async () => (await call(`/api/generations/${g.id}`)).status === "succeeded", "the demo GLB");
+ const { ctx, page, spark, tag } = await context(false, "light");
+ try {
+ await page.goto(`${app}/image-to-3d`, { waitUntil: "load" });
+ const card = page.locator("#your-3d-models article").first();
+ await card.getByRole("button", { name: "View in 3D" }).click({ timeout: 30_000 });
+ await card.locator("model-viewer").waitFor({ timeout: 60_000 });
+ await sleep(1000);
+ assert.deepEqual(spark, [], `${tag}: Spark fetched for a GLB`);
+ } catch (e) {
+ failures.push(`GLB: ${e.message}`);
+ }
+ await ctx.close();
+}
+
+// Reduced motion: the full-screen viewer keeps the orbit video until "Look around in 3D".
+{
+ step("reduced motion: the orbit video stays until asked");
+ const ctx = await browser.newContext({ ...DESKTOP, reducedMotion: "reduce" });
+ const page = await ctx.newPage();
+ page.on("pageerror", (e) => failures.push(`reduced motion: page error ${e.message}`));
+ try {
+ await page.goto(`${app}/library?tab=3d`, { waitUntil: "load" });
+ await sleep(1500);
+ await page
+ .getByRole("button", { name: /^Open “Gaussian splat/ })
+ .first()
+ .focus();
+ await page.keyboard.press("Enter");
+ const dialog = page.getByRole("dialog");
+ await dialog.getByRole("button", { name: "Look around in 3D" }).click({ timeout: 30_000 });
+ await dialog.getByRole("toolbar", { name: "3D view" }).waitFor({ timeout: 60_000 });
+ await shoot(page, "reduced-motion-panel");
+ } catch (e) {
+ failures.push(`reduced motion: ${e.message}`);
+ await shoot(page, "reduced-motion-failure");
+ }
+ await ctx.close();
+}
+
+await browser.close();
+if (failures.length) {
+ console.error(failures.join("\n"));
+ process.exit(1);
+}
+console.log("splat viewer: all checks passed");