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.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
WorldCast: the worker's contract, a reference server for your GPU, and its address in Settings
Claudeeb6e3fba45c0
diff --git a/docs/research/new-models-7.md b/docs/research/new-models-7.mdindex f66ef178..bd86fb8c 100644--- a/docs/research/new-models-7.md+++ b/docs/research/new-models-7.md@@ -471,7 +471,7 @@ All paths verified at `claude/fuobe-parity-4` (`7d7a765`). `git grep -i 'vggt|un- **Size mislabel** ("~2 GB" vs 10.38 GB) and a **paper / release mismatch** (patch embedding said to be trained, not shipped).- **Architecture-locked.** `BANK_CONFIG` (20 layers, interval 2, 8 heads, inner 1024, DiT RoPE, per-layer `proj_out`) must match or loading fails (`demo.py` L24-29). A newer checkpoint is in internal review and may change the format.- **Preset mismatch:** the card lists `orbit_360_push` and `spiral`, which the code doesn't implement.-- **Left / right convention:** WorldCast's left_side is at about 267° (`left_sign` −1); Fuobe's side picker uses the object's own left and right.+- **Left / right convention:** WorldCast's left_side is at about 267° (`left_sign` −1); Fuobe's side picker uses the object's own left and right. *(Correction, N7-9, 2026-11-02: the names are where the camera stands, not the body's sides. The demo case's aligned cameras (`no_padding_black/anchors_aligned_camera_info.json`) put `right_side` at +x of the first camera, moved round to the camera's own right, and its `right_side` crop shows the boy facing the lens because the first frame shows him in profile. With the front as the first frame, a person's own right side is WorldCast's `left_side` (270°); `worldcastAnchor` converts it, and `docs/workers/worldcast.md` has the table.)*- **Licences as information.** Weights are Apache-2.0, but Stage 1 trained on SpatialVID (CC BY-NC-SA 4.0) for "academic research purposes" only, by the authors' own statement. The paper's preprocessing models are non-commercial (VGGT-Omega) or research-only (Depth Pro). The permissive stand-ins (DA3, MoGe 2, SAM 3.1) are unvalidated with this model. Meridian and the H3 orbit LoRAs are territory-restricted.- **Holes and invention.** Pull-backs and trucks reveal background the first-frame cloud never saw; large orbits lean on the anchors; synthetic anchors (Qwen Multiple Angles) may drift (guess).- **Name collisions:** other "WorldCast" projects exist; pin repository ids, not names.diff --git a/docs/workers/worldcast.md b/docs/workers/worldcast.mdnew file mode 100644index 00000000..3c8e5ab1--- /dev/null+++ b/docs/workers/worldcast.md@@ -0,0 +1,144 @@+# WorldCast worker (optional, your GPU)++WorldCast ([PixCtrol/WorldCast](https://github.com/PixCtrol/WorldCast) `7ccf2e0d`, weights+[ly56/worldcast](https://huggingface.co/ly56/worldcast) `27635f27`) films a still along a camera path while the back+and sides of the subject follow up to four reference views. It is the open half of the Fuobe Fly-Around Original:+Cinema's **Fly path**, **Turnaround / Fly around this character** and the **exact orbits** (Fuobe DoP, Cinema's moves,+Image to 3D's "Film it photoreal", Assist's `fly_around`) film with it on the open engine while a worker answers.+Nobody hosts WorldCast, so there is no cloud route: the cloud keeps H3 Max camera controls and its references routes.++WorldCast has no ComfyUI port: it needs its own DiT code. So it runs as a separate HTTP service on your GPU, like the+[TRIBE v2 worker](tribe-v2.md). Fuobe ships a reference server in [`workers/worldcast/`](../../workers/worldcast/README.md).++Research: [`new-models-7.md`](../research/new-models-7.md) §3.1–§3.6, §3.8, §3.11.++## Licence++- WorldCast code and weights: **Apache-2.0** (on Wan2.1-I2V-14B-720P, Apache-2.0). WorldCast's README says Stage 1+ trained on SpatialVID (CC BY-NC-SA 4.0), which the authors used "strictly for academic research purposes and not for+ any commercial applications". Fuobe records this as information in Settings → Models & licences.+- What Fuobe prepares each case with: MoGe 2 (MIT), SAM 3.1 (Meta SAM License).+- Optional, the paper's own: Depth Pro (Apple research licence, no commercial use) and VGGT-Omega (FAIR+ Noncommercial, gated). Each has its row and switch in Settings → Models & licences.++## Setting++**Settings → Open-source engine → WorldCast worker URL**, beside the isolated worker (or `WORLDCAST_URL`). It is the+studio owner's setting. An account's runs never reach it: accounts run on their own ComfyUI, and the three buttons+plan their Uni3C / Frames runs for them without mentioning the worker.++Fuobe asks `GET /health` before it plans (an answer is kept for a minute). While the worker answers, the buttons film+with WorldCast; otherwise they run as before and say so: "Runs on Uni3C: add a WorldCast worker (48 GB+) for sides that+match your photos" (Frames, on Turnaround).++## How Fuobe prepares a case++One run is a few steps (`src/lib/catalog/worldcast-plan.ts`):++1. **Depth of the still**: MoGe 2 (`oss-scene-moge`, the 3D scene's) by default; Depth Pro or VGGT-Omega through+ `POST /depth` when the worker lists them.+2. **Person masks**: core `SAM3_Detect` with the pinned `sam3.1_multiplex_fp16` (`image-person-mask-sam3`), for the+ still and each view.+3. **The case** (`src/server/worldcast-case.ts`, `src/lib/worldcast.ts`):+ - the still, centre-cropped to WorldCast's portrait 480:832 and sized 480 × 832, and its mask cropped the same way;+ - the path: 81 camera-to-world poses from the camera-path library (`framePoses`), OpenCV axes (x right, y down,+ z forward), the world being the first frame's camera, so pose 0 is the identity; the pixel intrinsic of the+ 480 × 832 frame from the crop's field of view (Fuobe's default 24 mm lens);+ - `render.mp4` and `render_mask.mp4`: the still's point cloud (its MoGe depth) drawn along those poses, 81 frames at+ 15 fps, H.264; the mask is white (255) where no point landed (a hole) and black (0) where one did;+ - the anchors: the views with WorldCast's names and azimuths (below), each with its SAM 3.1 mask, at their own size;+ - `anchors_aligned_camera_info.json`: each anchor's camera on a level ring at the subject's distance, looking at+ it. This is a guess: the paper aligns real cameras with VGGT-Omega. Without the file WorldCast skips the anchors'+ Plücker rays; the quality impact of either is unknown.++### The anchors' names are where the camera stands++WorldCast's anchor names (front, right_side, back, left_side) name **where the camera stands**, measured from the+first frame's camera, with the azimuth growing as the camera moves round to its own right (Fuobe's camera-path+azimuth). WorldCast's own demo case shows this: its aligned `right_side` camera sits at +x of the first camera, and its+"right_side" crop shows the boy facing the lens, because the first frame shows him in profile.++Fuobe's views are named by the person's own sides, with the front as the first frame. To see a person's right side the+camera goes round to its left, so (`worldcastAnchor`):++| Fuobe side | WorldCast anchor | azimuth |+|---|---|---|+| front | `front` | 0° |+| right (the person's own) | `left_side` | 270° (`left_sign` −1: −90°) |+| back | `back` | 180° |+| left (the person's own) | `right_side` | 90° |++## Contract++All bodies are JSON unless said. Errors answer `{"error": "…"}` with an HTTP status.++### `GET {WORLDCAST_URL}/health`++```json+{ "ok": true, "model": "PixCtrol/WorldCast@7ccf2e0", "vram_gb": 80, "busy": false, "depth": ["depth-pro"] }+```++`ok` is false while the weights load. `depth` lists the extra depth models the worker can run (`depth-pro`,+`vggt-omega`).++### `POST {WORLDCAST_URL}/cases`++`multipart/form-data`:++| Part | Kind | What |+|---|---|---|+| `first_frame.png` | file | the first frame, 480 × 832 RGB |+| `person_mask.png` | file | its person mask, 480 × 832, white = the person |+| `render.mp4` | file | the point-cloud render along the path, 81 frames, 480 × 832, 15 fps |+| `render_mask.mp4` | file | its holes: 0 = covered, 255 = a hole |+| `cam_info.json` | file | `{width, height, num_frames: 81, intrinsic: 3×3, extrinsic: 81 × 4×4 camera-to-world (OpenCV), …}` |+| `anchors` | field | JSON list, at most four: `[{"side": "back", "azimuth": 180, "image": "anchor_back.png", "mask": "anchor_back_mask.png"}]` |+| `anchor_<side>.png`, `anchor_<side>_mask.png` | file | each anchor's whole picture and its person mask, the same size |+| `anchors_aligned_camera_info.json` | file, optional | `{views: ["first_frame", "front", …], extrinsic: world-to-camera 4×4 per view, intrinsic, width, height}` |+| `prompt` | field | one sentence about the subject and what it does |+| `seed` | field | integer |+| `steps`, `cfg`, `shift` | field | 50, 5.0, 2.0 (the checkpoint's) |+| `height`, `width` | field | 832, 480 |++Answers `{"id": "<job id>"}` (letters, digits, `-` and `_`, at most 64), or 422 with what was wrong, or 503 while the+weights load.++The reference server lays the case out as WorldCast's `demo_case/` is laid out and cuts the `no_padding_black/` crops+itself, as read from `demo_case/` and `worldcast_pipeline.py` L842–869 and `_encode_per_view_nopad`: the picture with+the background set to black, cropped tight to the mask's bounding box (the demo's 319 × 1028 crop of a 768 × 1344 frame+touches the person on all four sides), and the mask cropped the same way as a 0 / 255 PNG. The first frame's crop is+WorldCast's first-frame anchor (RoPE slot 0); the anchors take slots 25 / 30 / 35 / 40 by name.++### `POST {WORLDCAST_URL}/depth`++`multipart/form-data`: `model` (`depth-pro` or `vggt-omega`), `image` (the still). Answers `{"id": "…"}`, or 501 when+that model isn't installed. The result is `GET /jobs/{id}/depth.png`: an 8-bit grey depth picture of the still, near =+bright.++### `GET {WORLDCAST_URL}/jobs/{id}`++```json+{ "id": "…", "status": "running", "progress": 0.42, "message": "…" }+```++`status` is `queued`, `running`, `succeeded` or `failed` (with `error`). 404 when the worker doesn't know the job (it+was restarted, or the job was forgotten).++### `GET {WORLDCAST_URL}/jobs/{id}/video`++The clip: an MP4, 81 frames at 15 fps (5.4 s), 480 × 832. 409 until it's done.++### `DELETE {WORLDCAST_URL}/jobs/{id}`++Stops a queued or running job.++## After the run++The clip is portrait 480 × 832 at 15 fps. In Upscale, FPS Boost (RIFE) takes it to 24 fps and the upscalers enlarge+it, as for any clip.++## What can't be checked without the GPU++Everything that runs WorldCast: at least 48 GB of VRAM, an 82 GB base download, an unknown run time (20–40 minutes per+clip on one 80 GB card is a guess), quality with MoGe 2 depth instead of Depth Pro, and quality with ring cameras or+without aligned anchor cameras. Fuobe's client is tested against a stand-in worker (`tests/worldcast-worker.test.ts`).diff --git a/src/lib/catalog/worldcast-plan.ts b/src/lib/catalog/worldcast-plan.tsindex f843a7b2..8c120fa8 100644--- a/src/lib/catalog/worldcast-plan.ts+++ b/src/lib/catalog/worldcast-plan.ts@@ -36,7 +36,7 @@ export function worldcastNote(views: number, depth: WorldcastDepth = "moge"): st}/** Said after the run: what else the clip can go through. */-export const WORLDCAST_AFTER = "Smooth it to 24 fps with RIFE, or upscale it, from the result's menu";+export const WORLDCAST_AFTER = "In Upscale, FPS Boost (RIFE) takes the clip to 24 fps and the upscalers enlarge it";/** A picture of the run: a file, or what an earlier step makes. */export type WorldcastSource = { url: string } | { key: string };diff --git a/src/server/generations.ts b/src/server/generations.tsindex 5ae3f539..5a3183fc 100644--- a/src/server/generations.ts+++ b/src/server/generations.ts@@ -1916,6 +1916,8 @@ const POLL_MS = 1500;const FAST_POLL_MS = 500;/** How long a job may run once its provider has started it… */const TIMEOUT_MS = 45 * 60 * 1000;+/** …except on the WorldCast worker (N7-9): 50 steps at CFG 5 on a 14B model, tens of minutes a clip (its time is unpublished). */+const WORLDCAST_TIMEOUT_MS = 3 * 60 * 60 * 1000;/** …and how long it may wait in the provider's queue first (a busy local GPU works through jobs one by one). */const QUEUE_TIMEOUT_MS = 4 * 60 * 60 * 1000;/** A row this old with no external id, that no submit in this process is working on, was cut off by a restart. */@@ -2135,7 +2137,8 @@ async function pollOne(r: Row): Promise<void> {}// A job that has just left the queue gets its full running time from now.const startsNow = res?.state === "running" && !run.started_at;- const overdue = run.started_at ? now - run.started_at > TIMEOUT_MS : !startsNow && now - run.submitted_at > queueMs;+ const runMs = r.provider === "worldcast" ? WORLDCAST_TIMEOUT_MS : TIMEOUT_MS;+ const overdue = run.started_at ? now - run.started_at > runMs : !startsNow && now - run.submitted_at > queueMs;if (overdue) {// Stop the provider's job too, so it doesn't keep rendering (or billing) for nothing.await adapterFor(r.provider, account)@@ -2144,7 +2147,7 @@ async function pollOne(r: Row): Promise<void> {update(r.id, {status: "failed",error: run.started_at- ? `Timed out after ${TIMEOUT_MS / 60_000} minutes`+ ? `Timed out after ${runMs / 60_000} minutes`: res?.state === "queued" && res.timeoutError? res.timeoutError: onPooldiff --git a/src/server/providers/worldcast.ts b/src/server/providers/worldcast.tsindex 5d097394..68a75122 100644--- a/src/server/providers/worldcast.ts+++ b/src/server/providers/worldcast.ts@@ -1,7 +1,7 @@import "server-only";import { readLayout } from "@/lib/worldcast";import { buildCase } from "../worldcast-case";-import { cancelJob, jobStatus, jobVideoUrl, submitCase, worldcastBase, worldcastHealth } from "../worldcast";+import { WORKER_DEPTH, cancelJob, jobDepthUrl, jobStatus, jobVideoUrl, submitCase, submitDepth, worldcastBase, worldcastHealth, type WorkerDepth } from "../worldcast";import type { ProviderAdapter } from "./types";import { ProviderError } from "./types";@@ -26,7 +26,16 @@ export const worldcastProvider: ProviderAdapter = {// Kept as data until the case is made: nothing is sent before submit.prepareFile: async (data, contentType) => `data:${contentType || "application/octet-stream"};base64,${data.toString("base64")}`,- async submit({ input }) {+ async submit({ input, route }) {+ // The paper's own depth models (Depth Pro, VGGT-Omega), when the worker has them: route endpoint "depth/<model>".+ if (route.endpoint.startsWith("depth/")) {+ const model = route.endpoint.slice(6) as WorkerDepth;+ if (!WORKER_DEPTH.includes(model)) throw new ProviderError("The WorldCast worker doesn't run that model");+ const still = input.images?.[0];+ if (!still) throw new ProviderError("Add the still");+ const id = await submitDepth(model, fileOf(still));+ return { externalId: id, meta: { depth: model }, payload: { job: id, depth: model } };+ }const layout = readLayout(input.extra?.worldcast);const images = (input.images ?? []).map(fileOf);const keys = input.cameraPath ?? [];@@ -47,8 +56,9 @@ export const worldcastProvider: ProviderAdapter = {};},- async poll({ externalId }) {+ async poll({ externalId, meta }) {const job = await jobStatus(externalId);+ if (job.status === "succeeded" && typeof meta.depth === "string") return { state: "succeeded", outputs: [{ url: jobDepthUrl(externalId), kind: "image", contentType: "image/png", meta: { role: "depth" } }] };if (job.status === "succeeded") return { state: "succeeded", outputs: [{ url: jobVideoUrl(externalId), kind: "video", contentType: "video/mp4", meta: { fps: 15 } }] };if (job.status === "failed") return { state: "failed", error: job.error };return { state: job.status, ...(job.progress !== undefined && { progress: job.progress }), message: job.message ?? (job.status === "queued" ? "Waiting for the WorldCast worker" : "WorldCast is filming") };diff --git a/src/server/worldcast.ts b/src/server/worldcast.tsindex fcfc9cc3..44b5e0b8 100644--- a/src/server/worldcast.ts+++ b/src/server/worldcast.ts@@ -167,6 +167,28 @@ export function jobVideoUrl(id: string): string {return `${worldcastBase()}/jobs/${id}/video`;}+/** The extra depth models the worker may run (POST /depth). */+export const WORKER_DEPTH = ["depth-pro", "vggt-omega"] as const;+export type WorkerDepth = (typeof WORKER_DEPTH)[number];++/** POST /depth: one picture's depth with the paper's own model, as a job; its picture is GET /jobs/{id}/depth.png. */+export async function submitDepth(model: WorkerDepth, image: Buffer, contentType = "image/png"): Promise<string> {+ const form = new FormData();+ form.append("model", model);+ form.append("image", new Blob([new Uint8Array(image)], { type: contentType }), "image.png");+ const res = await call("/depth", { method: "POST", body: form }, 5 * 60_000);+ if (!res.ok) throw await failure("a depth job", res);+ const j = (await res.json().catch(() => ({}))) as { id?: unknown };+ if (typeof j.id !== "string" || !JOB_ID.test(j.id)) throw new ProviderError("The WorldCast worker didn't answer with a job id");+ return j.id;+}++/** A depth job's picture (GET /jobs/{id}/depth.png). */+export function jobDepthUrl(id: string): string {+ if (!JOB_ID.test(id)) throw new ProviderError("That isn't a WorldCast job");+ return `${worldcastBase()}/jobs/${id}/depth.png`;+}+/** GET /jobs/{id}/video: the MP4. */export async function jobVideo(id: string): Promise<Buffer> {if (!JOB_ID.test(id)) throw new ProviderError("That isn't a WorldCast job");diff --git a/tests/worldcast-plan.test.ts b/tests/worldcast-plan.test.tsindex 88b9a8e7..2e0e8fcb 100644--- a/tests/worldcast-plan.test.ts+++ b/tests/worldcast-plan.test.ts@@ -146,6 +146,19 @@ describe("the WorldCast models", () => {});});+describe("public sign-up", () => {+ it("never sends an account's run to the studio's worker, and says nothing about it to a visitor", async () => {+ const { accountRun, asVisitor } = await import("@/server/generations");+ const { runAsTenant } = await import("@/server/tenant");+ const { worldcastContext } = await import("@/server/worldcast-on");+ expect(accountRun("acct-1", "worldcast")).toMatchObject({ code: "own-gpu-tool" });+ expect(runAsTenant({ kind: "account", id: "acct-1" }, () => worldcastContext())).toBeUndefined();+ expect(asVisitor(null, () => worldcastContext())).toBeUndefined();+ // The owner, with no worker set: Fly path says what it films on.+ expect(worldcastContext()).toBe(false);+ });+});+const ffmpeg = spawnSync("ffmpeg", ["-version"]).status === 0;describe.skipIf(!ffmpeg)("the server's case", async () => {diff --git a/tests/worldcast-worker.test.ts b/tests/worldcast-worker.test.tsindex 7481f6fc..18128f1f 100644--- a/tests/worldcast-worker.test.ts+++ b/tests/worldcast-worker.test.ts@@ -40,7 +40,15 @@ const server = http.createServer((req, res) => {});return;}- const m = /^\/jobs\/([^/]+)(\/video)?$/.exec(url);+ if (req.method === "POST" && url === "/depth") {+ req.resume();+ req.on("end", () => {+ state.jobs.set("depth1", { status: "succeeded" });+ send(200, { id: "depth1" });+ });+ return;+ }+ const m = /^\/jobs\/([^/]+)(\/video|\/depth\.png)?$/.exec(url);if (m) {const job = state.jobs.get(m[1]);if (req.method === "DELETE") {@@ -162,6 +170,15 @@ describe("the WorldCast worker's client", () => {expect(await worldcastProvider.prepareFile(Buffer.from("x"), "image/png", "a.png")).toBe("data:image/png;base64,eA==");});+ it("runs the paper's depth model as a job when asked, and hands its picture on", async () => {+ const route = { op: "edit", provider: "worldcast", endpoint: "depth/depth-pro" } as const;+ const sub = await worldcastProvider.submit({ generationId: "g", model: {} as never, route: route as never, input: { images: ["data:image/png;base64,eA=="] } as never });+ expect(sub).toMatchObject({ externalId: "depth1", meta: { depth: "depth-pro" } });+ const polled = await worldcastProvider.poll({ externalId: "depth1", meta: sub.meta!, route: route as never, model: {} as never, createdAt: 0 });+ expect(polled).toMatchObject({ state: "succeeded", outputs: [{ url: `http://127.0.0.1:${port}/jobs/depth1/depth.png`, kind: "image" }] });+ await expect(worldcastProvider.submit({ generationId: "g", model: {} as never, route: { ...route, endpoint: "depth/nope" } as never, input: { images: ["data:image/png;base64,eA=="] } as never })).rejects.toThrow(/doesn't run that model/);+ });+it("refuses an account's run, and says where to set the worker when none answers", async () => {await expect(runAsTenant({ kind: "account", id: "a1" }, () => wc.submitCase(parts()))).rejects.toThrow(/studio's own GPU only/);const saved = process.env.WORLDCAST_URL;diff --git a/workers/worldcast/README.md b/workers/worldcast/README.mdnew file mode 100644index 00000000..4ccc8755--- /dev/null+++ b/workers/worldcast/README.md@@ -0,0 +1,95 @@+# WorldCast worker (reference server)++A small HTTP service that runs [PixCtrol/WorldCast](https://github.com/PixCtrol/WorldCast) on your own GPU, outside+ComfyUI, for Fuobe's Fly path, Turnaround and exact orbits. Fuobe prepares each case and sends it here. The contract is+[`docs/workers/worldcast.md`](../../docs/workers/worldcast.md).++`server.py` is Fuobe's code (it has no dependencies on the rest of Fuobe). WorldCast's own code runs inside it, from+WorldCast's clone, in WorldCast's own virtualenv. Read WorldCast's code before you run it, as you would any project+you download.++## What it needs++- **A GPU with at least 48 GB of VRAM** (WorldCast's README and model card). Runtime per clip isn't published; on one+ 80 GB card expect tens of minutes (a guess from Uni3C's figures, not measured).+- **About 95 GB of disk**: the Wan 2.1 I2V 720P base (82.22 GB) and WorldCast's two checkpoints (10.38 GB in all,+ though the card says "~2 GB").+- Linux with CUDA 12.8, Python 3.10–3.12, ffmpeg.++## Install++Pin everything to the versions Fuobe was written against:++```bash+git clone https://github.com/PixCtrol/WorldCast /opt/WorldCast+cd /opt/WorldCast && git checkout 7ccf2e0ded1238bf6dea1b285c29bcf322e337cb+python -m venv .venv && . .venv/bin/activate+# WorldCast's verified combination (requirements.txt, 2026-10-23)+pip install torch==2.8.0 torchvision --index-url https://download.pytorch.org/whl/cu128+pip install transformers==5.8.1+pip install -r requirements.txt+pip install -r /path/to/fuobe/workers/worldcast/requirements.txt++# Weights (both checkpoints must come from the same release)+hf download ly56/worldcast --revision 27635f27a2f9414dd8b78542eb390b565a288a53 \+ checkpoints/base_dit.safetensors checkpoints/worldcast_bank.safetensors --local-dir .+hf download Wan-AI/Wan2.1-I2V-14B-720P --revision 8823af45fcc58a8aa999a54b04be9abc7d2aac98 \+ --local-dir pretrained/Wan2.1-I2V-14B-720P+```++Expected sizes: `checkpoints/base_dit.safetensors` 8,401,611,192 bytes and `checkpoints/worldcast_bank.safetensors`+1,982,937,976 bytes.++## Check WorldCast first++Before you start the worker, run WorldCast's own demo once, so you know the install works on your GPU:++```bash+python demo.py --manifest demo_case_traj5.json \+ --model_root pretrained/Wan2.1-I2V-14B-720P \+ --ckpt checkpoints/worldcast_bank.safetensors \+ --init_dit_from checkpoints/base_dit.safetensors+```++It writes five clips to `outputs_demo/`. If that fails, the worker fails the same way.++## Start++```bash+cd /opt/WorldCast && . .venv/bin/activate+WORLDCAST_REPO=/opt/WorldCast python /path/to/fuobe/workers/worldcast/server.py --port 8190+```++It loads the weights in the background: `GET /health` answers `"ok": false` until they're in. Then add the address+in Fuobe, in **Settings → Open-source engine → WorldCast worker URL** (or `WORLDCAST_URL=http://127.0.0.1:8190`), and+press **Save & test**.++Listen on `127.0.0.1` when Fuobe runs on the same machine. The worker has no login: if Fuobe runs elsewhere, put it+behind a tunnel or a proxy that only Fuobe's server can reach.++| Variable | Default |+|---|---|+| `WORLDCAST_REPO` | the current folder |+| `WORLDCAST_MODEL_ROOT` | `$WORLDCAST_REPO/pretrained/Wan2.1-I2V-14B-720P` |+| `WORLDCAST_CKPT` | `$WORLDCAST_REPO/checkpoints/worldcast_bank.safetensors` |+| `WORLDCAST_BASE_DIT` | `$WORLDCAST_REPO/checkpoints/base_dit.safetensors` |+| `WORLDCAST_WORK_DIR` | `$WORLDCAST_REPO/fuobe_jobs` (the 50 latest jobs are kept) |+| `WORLDCAST_DEPTH_PRO` | `$WORLDCAST_REPO/checkpoints/depth_pro.pt` |++## Optional: the paper's depth model++Fuobe measures depth with MoGe 2 (MIT) by default. The paper used Apple's **Depth Pro**, under Apple's research licence+(no commercial use). To offer it, install [apple/ml-depth-pro](https://github.com/apple/ml-depth-pro) into the same+virtualenv and put `depth_pro.pt` (apple/DepthPro @ `ccd1350a`) at `WORLDCAST_DEPTH_PRO`. `GET /health` then lists+`"depth": ["depth-pro"]`, and Fuobe offers it where its admin has it switched on in Settings → Models & licences.++**VGGT-Omega** (facebook/VGGT-Omega, FAIR Noncommercial, a gated download) is recorded in Fuobe with its licence and its+switch, but this reference server doesn't run it yet.++## Licences++- WorldCast code and weights: Apache-2.0. Its README says Stage 1 trained on SpatialVID (CC BY-NC-SA 4.0), which the+ authors used "strictly for academic research purposes and not for any commercial applications".+- Wan2.1-I2V-14B-720P: Apache-2.0.+- Depth Pro (optional): Apple ML Research licence, research only.+- VGGT-Omega (optional, not wired): FAIR Noncommercial Research License.diff --git a/workers/worldcast/requirements.txt b/workers/worldcast/requirements.txtnew file mode 100644index 00000000..b89b3456--- /dev/null+++ b/workers/worldcast/requirements.txt@@ -0,0 +1,5 @@+# The Fuobe WorldCast worker's own needs, on top of WorldCast's requirements.txt (PixCtrol/WorldCast @ 7ccf2e0d).+# WorldCast's README verified torch 2.8.0+cu128 with transformers 5.8.1 (2026-10-23): install those first, see README.md.+fastapi==0.115.12+uvicorn==0.34.2+python-multipart==0.0.20diff --git a/workers/worldcast/server.py b/workers/worldcast/server.pynew file mode 100644index 00000000..8049a4ff--- /dev/null+++ b/workers/worldcast/server.py@@ -0,0 +1,437 @@+#!/usr/bin/env python3+"""Fuobe's WorldCast worker: a thin HTTP service around PixCtrol/WorldCast @ 7ccf2e0d (Apache-2.0).++The contract is docs/workers/worldcast.md in the Fuobe repository. Fuobe prepares each case (the still and its person+mask, the camera path's point-cloud render and hole mask, cam_info.json, the anchors and their masks); this server lays+it out the way WorldCast's demo_case/ is laid out, cuts the no_padding_black/ crops, and runs the same pipeline wiring+as WorldCast's demo.py (the released anchor-drop checkpoint's fixed architecture). One job at a time, in order.++Run it from WorldCast's own clone, in WorldCast's own virtualenv (README.md beside this file):++ WORLDCAST_REPO=/opt/WorldCast python server.py --port 8190++Nothing here is Fuobe's code at run time: Fuobe only talks to it over HTTP.+"""+import argparse+import io+import json+import os+import shutil+import sys+import threading+import time+import traceback+import uuid+from collections import OrderedDict++import numpy as np+from fastapi import FastAPI, HTTPException, Request+from fastapi.responses import FileResponse, JSONResponse+from PIL import Image++REPO = os.path.abspath(os.environ.get("WORLDCAST_REPO", "."))+WORK = os.path.abspath(os.environ.get("WORLDCAST_WORK_DIR", os.path.join(REPO, "fuobe_jobs")))+MODEL_ROOT = os.environ.get("WORLDCAST_MODEL_ROOT", os.path.join(REPO, "pretrained", "Wan2.1-I2V-14B-720P"))+CKPT = os.environ.get("WORLDCAST_CKPT", os.path.join(REPO, "checkpoints", "worldcast_bank.safetensors"))+BASE_DIT = os.environ.get("WORLDCAST_BASE_DIT", os.path.join(REPO, "checkpoints", "base_dit.safetensors"))+DEPTH_PRO_CKPT = os.environ.get("WORLDCAST_DEPTH_PRO", os.path.join(REPO, "checkpoints", "depth_pro.pt"))+MODEL_NAME = "PixCtrol/WorldCast@7ccf2e0"+KEEP_JOBS = 50+MAX_UPLOAD = 512 * 2**20++VIEWS = ("front", "left_side", "right_side", "back")+FRAMES, FPS, WIDTH, HEIGHT = 81, 15, 480, 832+JOB_ID_CHARS = set("abcdefghijklmnopqrstuvwxyz0123456789")++app = FastAPI(title="Fuobe WorldCast worker")+jobs: "OrderedDict[str, dict]" = OrderedDict()+lock = threading.Lock()+wake = threading.Condition(lock)+state = {"ready": False, "error": None, "pipe": None, "parts": None, "depth_pro": None}+++class Canceled(Exception):+ pass+++# ---------------------------------------------------------------------------+# The pipeline, loaded once (demo.py's wiring)+++def load_worldcast():+ for p in (REPO, os.path.join(REPO, "scripts", "infer")):+ if p not in sys.path:+ sys.path.insert(0, p)+ from safetensors.torch import load_file+ from infer_worldcast import load_pipeline, load_checkpoint+ from diffsynth.pipelines.worldcast_pipeline_interleave import model_fn_worldcast+ import demo # WorldCast's own demo.py: BANK_CONFIG, ANCHOR_PRIORITY, build_bank, build_anchor_adapter++ pipe = load_pipeline(model_root=MODEL_ROOT)+ pipe.anchor_max_frames = 4+ pipe.use_anchor_nopad_mask = True+ pipe.use_anchor_no_padding_black = True+ pipe.use_anchor_random_count = True+ pipe.anchor_random_count_no_shuffle = True+ pipe.anchor_random_count_priority = demo.ANCHOR_PRIORITY+ pipe.anchor_random_count_min = demo.ANCHOR_K+ pipe.anchor_random_count_max = demo.ANCHOR_K+ pipe.anchor_random_count_zero_fill = True+ pipe.use_first_frame_anchor = True+ pipe.use_anchor_selected_views_order = True+ pipe.use_anchor_plucker = True+ pipe.model_fn = model_fn_worldcast+ ckpt = load_file(CKPT)+ camera_proj, i2v_channel_adapter = load_checkpoint(pipe, ckpt, init_dit_from=BASE_DIT)+ bank = demo.build_bank(pipe, ckpt)+ adapter = demo.build_anchor_adapter(pipe, ckpt)+ state["pipe"] = pipe+ state["parts"] = dict(camera_proj=camera_proj, i2v_channel_adapter=i2v_channel_adapter, source_self_attn_bank=bank, anchor_channel_adapter=adapter)+++def depth_models():+ """The extra depth models this worker can run (Fuobe offers them only when listed in GET /health)."""+ out = []+ try:+ import depth_pro # noqa: F401 (apple/ml-depth-pro, installed by hand: Apple research licence)++ if os.path.isfile(DEPTH_PRO_CKPT):+ out.append("depth-pro")+ except ImportError:+ pass+ # VGGT-Omega (facebook/VGGT-Omega, FAIR Noncommercial, gated) is not wired in this reference server yet.+ return out+++# ---------------------------------------------------------------------------+# Cases: Fuobe's files laid out as WorldCast's demo_case/+++def binary(mask: Image.Image) -> Image.Image:+ return mask.convert("L").point(lambda v: 255 if v >= 128 else 0)+++def nopad(image: Image.Image, mask: Image.Image):+ """no_padding_black/: the person kept, the background black, cropped tight to the mask (the demo case's crops touch+ the person on all four sides and carry a 0/255 mask of the same size)."""+ m = binary(mask.resize(image.size, Image.NEAREST))+ box = m.getbbox()+ if box is None:+ raise ValueError("the person mask is empty: no person was found in a picture")+ rgb = np.array(image.convert("RGB"))+ rgb[np.array(m) < 128] = 0+ return Image.fromarray(rgb).crop(box), m.crop(box)+++def write_case(job_dir: str, form) -> dict:+ render = os.path.join(job_dir, "render")+ anchors_dir = os.path.join(job_dir, "anchors")+ os.makedirs(os.path.join(render, "no_padding_black", "person_mask"), exist_ok=True)+ os.makedirs(os.path.join(anchors_dir, "no_padding_black", "person_mask"), exist_ok=True)+ os.makedirs(os.path.join(anchors_dir, "person_mask"), exist_ok=True)++ def data(name, required=True):+ f = form.get(name)+ if f is None or isinstance(f, str):+ if required:+ raise ValueError(f"{name} is missing")+ return None+ return f++ def image(name):+ return Image.open(io.BytesIO(data(name)))++ first = image("first_frame.png").convert("RGB")+ if first.size != (WIDTH, HEIGHT):+ raise ValueError(f"first_frame.png is {first.size[0]}x{first.size[1]}, not {WIDTH}x{HEIGHT}")+ first.save(os.path.join(render, "first_frame.png"))+ crop, cmask = nopad(first, image("person_mask.png"))+ crop.save(os.path.join(render, "no_padding_black", "first_frame.png"))+ cmask.save(os.path.join(render, "no_padding_black", "person_mask", "first_frame.png"))+ for name in ("render.mp4", "render_mask.mp4"):+ with open(os.path.join(render, name), "wb") as out:+ out.write(data(name))+ cam = json.loads(data("cam_info.json"))+ if len(cam.get("extrinsic", [])) != FRAMES:+ raise ValueError(f"cam_info.json needs {FRAMES} poses")+ with open(os.path.join(render, "cam_info.json"), "w") as out:+ json.dump(cam, out)+ aligned = data("anchors_aligned_camera_info.json", required=False)+ if aligned:+ with open(os.path.join(render, "no_padding_black", "anchors_aligned_camera_info.json"), "wb") as out:+ out.write(aligned)++ anchors = json.loads(form.get("anchors") or "[]")+ if len(anchors) > 4:+ raise ValueError("up to four anchors")+ selected, per_view = [], {}+ for a in anchors:+ side = a.get("side")+ if side not in VIEWS or side in per_view:+ raise ValueError(f"unknown or repeated anchor side {side!r}")+ pic = Image.open(io.BytesIO(data(a["image"]))).convert("RGB")+ crop, cmask = nopad(pic, Image.open(io.BytesIO(data(a["mask"]))))+ fname = f"body_view_{side}.png"+ pic.save(os.path.join(anchors_dir, fname))+ crop.save(os.path.join(anchors_dir, "no_padding_black", fname))+ cmask.save(os.path.join(anchors_dir, "no_padding_black", "person_mask", fname))+ cmask.save(os.path.join(anchors_dir, "person_mask", fname))+ per_view[side] = {"azimuth_deg": float(a.get("azimuth", 0))}+ selected = [v for v in VIEWS if v in per_view]+ with open(os.path.join(anchors_dir, "body_views_meta.json"), "w") as out:+ json.dump({"az_front_deg": 0.0, "left_sign": -1, "selected_views": selected, "per_view": per_view}, out)++ num = lambda k, d, cast=float: cast(form.get(k) or d) # noqa: E731+ return dict(+ prompt=str(form.get("prompt") or ""),+ seed=num("seed", 42, int),+ steps=num("steps", 50, int),+ cfg=num("cfg", 5.0),+ shift=num("shift", 2.0),+ height=num("height", HEIGHT, int),+ width=num("width", WIDTH, int),+ render=render,+ anchors=anchors_dir if selected else "",+ )+++def run_case(job: dict):+ from diffsynth.utils.data import save_video++ a = job["args"]+ total = a["steps"]++ def progress(it):+ for i, x in enumerate(it):+ if job.get("cancel"):+ raise Canceled()+ job["progress"] = round(0.02 + 0.93 * i / max(1, total), 3)+ yield x++ first = os.path.join(a["render"], "first_frame.png")+ video = state["pipe"](+ prompt=a["prompt"],+ reference_image_path=first,+ render_path=a["render"],+ input_image=Image.open(first).convert("RGB"),+ seed=a["seed"],+ tiled=True,+ height=a["height"],+ width=a["width"],+ num_frames=FRAMES,+ nframe=FRAMES,+ num_inference_steps=a["steps"],+ cfg_scale=a["cfg"],+ sigma_shift=a["shift"],+ invert_camera_extrinsic=False,+ viewpoint_anchors_path=a["anchors"],+ anchor_plucker_use_camera_proj=True,+ progress_bar_cmd=progress,+ **state["parts"],+ )+ out = os.path.join(job["dir"], "worldcast.mp4")+ save_video(video, out, fps=FPS, quality=5)+ job["output"] = out+++def run_depth(job: dict):+ import depth_pro++ if state["depth_pro"] is None:+ cfg = depth_pro.depth_pro.DEFAULT_MONODEPTH_CONFIG_DICT+ cfg.checkpoint_uri = DEPTH_PRO_CKPT+ model, transform = depth_pro.create_model_and_transforms(config=cfg)+ model.eval()+ state["depth_pro"] = (model, transform)+ model, transform = state["depth_pro"]+ image, _, f_px = depth_pro.load_rgb(job["args"]["image"])+ depth = model.infer(transform(image), f_px=f_px)["depth"].squeeze().detach().cpu().numpy()+ # Near is bright: inverse depth spread over 0-255 (Fuobe's point cloud reads either way round).+ inv = 1.0 / np.clip(depth, 1e-3, None)+ lo, hi = np.percentile(inv, 1), np.percentile(inv, 99)+ grey = np.clip((inv - lo) / max(1e-6, hi - lo), 0, 1) * 255+ out = os.path.join(job["dir"], "depth.png")+ Image.fromarray(grey.astype(np.uint8)).save(out)+ job["output"] = out+++def runner():+ while True:+ with wake:+ while not any(j["status"] == "queued" for j in jobs.values()):+ wake.wait()+ job = next(j for j in jobs.values() if j["status"] == "queued")+ job["status"] = "running"+ job["started"] = time.time()+ try:+ (run_depth if job["kind"] == "depth" else run_case)(job)+ job["status"], job["progress"] = "succeeded", 1.0+ except Canceled:+ job["status"], job["error"] = "failed", "stopped"+ except Exception as e: # noqa: BLE001+ traceback.print_exc()+ job["status"], job["error"] = "failed", f"{type(e).__name__}: {e}"[:300]+ finally:+ try:+ import torch++ torch.cuda.empty_cache()+ except Exception: # noqa: BLE001+ pass+++def new_job(kind: str) -> dict:+ jid = uuid.uuid4().hex[:16]+ d = os.path.join(WORK, jid)+ os.makedirs(d, exist_ok=True)+ return {"id": jid, "kind": kind, "dir": d, "status": "queued", "progress": 0.0, "created": time.time()}+++def enqueue(job: dict):+ with wake:+ jobs[job["id"]] = job+ # Forget the oldest finished jobs (and their files).+ done = [k for k, j in jobs.items() if j["status"] in ("succeeded", "failed")]+ for k in done[: max(0, len(jobs) - KEEP_JOBS)]:+ shutil.rmtree(jobs.pop(k)["dir"], ignore_errors=True)+ wake.notify()+++def find(jid: str) -> dict:+ if not jid or set(jid) - JOB_ID_CHARS or jid not in jobs:+ raise HTTPException(404, "no such job")+ return jobs[jid]+++async def read_form(request: Request):+ if int(request.headers.get("content-length") or 0) > MAX_UPLOAD:+ raise HTTPException(413, "the case is too big")+ form = await request.form()+ out = {}+ for k, v in form.multi_items():+ out[k] = v if isinstance(v, str) else await v.read()+ return out+++# ---------------------------------------------------------------------------+# HTTP++[email protected]_handler(HTTPException)+async def http_error(_req, e: HTTPException):+ return JSONResponse({"error": str(e.detail)}, status_code=e.status_code)++[email protected]("/health")+def health():+ vram = None+ try:+ import torch++ if torch.cuda.is_available():+ vram = torch.cuda.get_device_properties(0).total_memory / 2**30+ except Exception: # noqa: BLE001+ pass+ busy = any(j["status"] in ("queued", "running") for j in jobs.values())+ body = {"ok": state["ready"], "model": MODEL_NAME, "vram_gb": vram, "busy": busy, "depth": depth_models()}+ if state["error"]:+ body["error"] = state["error"]+ return body++[email protected]("/cases")+async def cases(request: Request):+ if not state["ready"]:+ raise HTTPException(503, state["error"] or "still loading WorldCast's weights")+ form = await read_form(request)+ job = new_job("case")+ try:+ job["args"] = write_case(job["dir"], form)+ except (ValueError, KeyError, json.JSONDecodeError) as e:+ shutil.rmtree(job["dir"], ignore_errors=True)+ raise HTTPException(422, str(e))+ enqueue(job)+ return {"id": job["id"]}++[email protected]("/depth")+async def depth(request: Request):+ form = await read_form(request)+ model = form.get("model")+ if model not in depth_models():+ raise HTTPException(501, f"{model} isn't installed on this worker")+ pic = form.get("image")+ if not pic or isinstance(pic, str):+ raise HTTPException(422, "image is missing")+ job = new_job("depth")+ path = os.path.join(job["dir"], "image.png")+ Image.open(io.BytesIO(pic)).convert("RGB").save(path)+ job["args"] = {"image": path, "model": model}+ enqueue(job)+ return {"id": job["id"]}++[email protected]("/jobs/{jid}")+def job_status(jid: str):+ j = find(jid)+ body = {"id": j["id"], "status": j["status"], "progress": j["progress"]}+ if j["status"] == "queued":+ ahead = [k for k, x in jobs.items() if x["status"] in ("queued", "running")].index(jid)+ body["message"] = f"{ahead} job(s) ahead" if ahead else "next"+ if j.get("error"):+ body["error"] = j["error"]+ return body++[email protected]("/jobs/{jid}/video")+def job_video(jid: str):+ j = find(jid)+ if j["status"] != "succeeded" or j["kind"] != "case":+ raise HTTPException(409, "the clip isn't ready")+ return FileResponse(j["output"], media_type="video/mp4", filename="worldcast.mp4")++[email protected]("/jobs/{jid}/depth.png")+def job_depth(jid: str):+ j = find(jid)+ if j["status"] != "succeeded" or j["kind"] != "depth":+ raise HTTPException(409, "the depth isn't ready")+ return FileResponse(j["output"], media_type="image/png", filename="depth.png")++[email protected]("/jobs/{jid}")+def job_cancel(jid: str):+ j = find(jid)+ if j["status"] == "queued":+ j["status"], j["error"] = "failed", "stopped"+ elif j["status"] == "running":+ j["cancel"] = True+ return {"ok": True}+++def load_in_background():+ try:+ os.chdir(REPO)+ load_worldcast()+ state["ready"] = True+ print("WorldCast is ready", flush=True)+ except Exception as e: # noqa: BLE001+ traceback.print_exc()+ state["error"] = f"WorldCast couldn't load: {type(e).__name__}: {e}"[:300]+++def main():+ p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)+ p.add_argument("--host", default="127.0.0.1")+ p.add_argument("--port", type=int, default=8190)+ args = p.parse_args()+ os.makedirs(WORK, exist_ok=True)+ threading.Thread(target=load_in_background, daemon=True).start()+ threading.Thread(target=runner, daemon=True).start()+ import uvicorn++ uvicorn.run(app, host=args.host, port=args.port)+++if __name__ == "__main__":+ main()