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.

N7-6 fixes: References ends on the front, camera words follow the path, every cast variant is a sheet, H3 Max 2K

Claude22369ae05eb8
diff --git a/scripts/gen-cloud-models.py b/scripts/gen-cloud-models.py
index dd6d654a..994e6308 100644
--- a/scripts/gen-cloud-models.py
+++ b/scripts/gen-cloud-models.py
@@ -472,9 +472,10 @@ model("minimax-h3-max", "MiniMax H3 Max", "MiniMax", "hailuo", "video", "Top-tie
# Build plan N7-6 (Turnaround video): fal bills every H3 Max route per second by resolution (the records' price
# text); the flat rate read from the image-to-video record was its 480P launch price. Reference-to-video has no
# launch price, so the list rates are used for all of them (image and text to video cost less until 2026-10-31).
- # Four square references are included; each further one adds about $0.02 (not counted here).
- pricing=("second", 0.08, "768P; 480P $0.05, 1080P $0.16 — image and text to video at the launch price $0.052 (480P $0.0325, 1080P $0.104) until 2026-10-31; reference to video: 4 square references included, about $0.02 for each one after",
- {"byResolution": {"480P": 0.05, "768P": 0.08, "1080P": 0.16}}))
+ # Four square references are included; each further one adds about $0.02 (not counted here). 2K is extend's alone
+ # ($0.32/s, its record). No Pricing.promo: it would apply to every route, and reference to video has no launch price.
+ pricing=("second", 0.08, "768P; 480P $0.05, 1080P $0.16, 2K $0.32 (extend) — image and text to video at the launch price $0.052 (480P $0.0325, 1080P $0.104) until 2026-10-31; reference to video: 4 square references included, about $0.02 for each one after",
+ {"byResolution": {"480P": 0.05, "768P": 0.08, "1080P": 0.16, "2K": 0.32}}))
# Build plan N7-5 (Fly path in Cinema's 3D scene): H3 Max following a keyframed camera path from one still. A hidden
# helper (Cinema's "Film this path" picks it), priced per second by resolution: fal's launch rates until 2026-10-31, then
# the list rates (Pricing.promo). Prompt expansion stays off so the user's motion words reach the model as written.
diff --git a/src/lib/catalog/cloud-models.generated.ts b/src/lib/catalog/cloud-models.generated.ts
index b776363a..9d9f333f 100644
--- a/src/lib/catalog/cloud-models.generated.ts
+++ b/src/lib/catalog/cloud-models.generated.ts
@@ -6308,11 +6308,12 @@ export const CLOUD_MODELS: ModelDef[] = [
"pricing": {
"unit": "second",
"usd": 0.08,
- "note": "768P; 480P $0.05, 1080P $0.16 \u2014 image and text to video at the launch price $0.052 (480P $0.0325, 1080P $0.104) until 2026-10-31; reference to video: 4 square references included, about $0.02 for each one after",
+ "note": "768P; 480P $0.05, 1080P $0.16, 2K $0.32 (extend) \u2014 image and text to video at the launch price $0.052 (480P $0.0325, 1080P $0.104) until 2026-10-31; reference to video: 4 square references included, about $0.02 for each one after",
"byResolution": {
"480P": 0.05,
"768P": 0.08,
- "1080P": 0.16
+ "1080P": 0.16,
+ "2K": 0.32
}
}
},
diff --git a/src/lib/catalog/turnaround.ts b/src/lib/catalog/turnaround.ts
index 3b7cbe31..34a53a36 100644
--- a/src/lib/catalog/turnaround.ts
+++ b/src/lib/catalog/turnaround.ts
@@ -13,7 +13,7 @@
* N7-9 later puts WorldCast behind the same buttons on the open engine; its side names and angles are written down here.
* Pure: the browser prices it live, the server runs the same steps (src/server/turnaround.ts, Cinema's "turnaround").
*/
-import { PATH_PRESETS, presetKeys, type CameraKey } from "@/lib/camera-path";
+import { DEFAULT_MOTION, PATH_PRESETS, presetKeys, type CameraKey } from "@/lib/camera-path";
import { poseWords } from "@/lib/scene3d";
import { getModel, getPreset } from "./index";
import { onEngine } from "./engines";
@@ -155,9 +155,18 @@ export const TURN_PATHS = [
];
export const DEFAULT_PATH = TURN_PATHS[0].id;
-/** The words every turnaround films to (the open engine's and FLUX 3 Max's frames, the camera path). */
+/** The words a turnaround films to (the open engine's and FLUX 3 Max's frames, the camera path's level rings). */
export const ORBIT_PROMPT = "The camera orbits 360 degrees around the person at a constant height; the person stands naturally";
+/**
+ * The camera route's words for a path: the orbit's own words only for a level full ring (Orbit 360°, either way round);
+ * any other move (an arc, a tilted ring, a dolly) gets N7-5's neutral words, so the prompt never fights the path the
+ * model follows exactly (prompt expansion is off on this route, so nothing reconciles the two).
+ */
+export function cameraWords(path: string, extra?: string): string {
+ return withWords(/^orbit_360(_c?cw)?$/.test(path) ? ORBIT_PROMPT : DEFAULT_MOTION, extra);
+}
+
const FILL_KEEP = "Keep the same person: identity, face, hair, body, outfit, lighting and plain background";
const SHEET_FRONT_PROMPT =
"Image 1 is a character turnaround sheet. Show only this character's front view as one full-body picture, centred and facing the camera, on the same plain backdrop and light. Keep the face, hair, body and outfit exactly as on the sheet; no text, no other views";
@@ -201,21 +210,25 @@ export interface TurnPicture {
const TILES: { label: string; side?: TurnSide }[] = [{ label: "Front", side: "front" }, { label: "Three-quarter" }, { label: "Profile" }, { label: "Back", side: "back" }];
/**
- * The pictures a finished Character Sheet or Soul Cast result offers: the views its graph cut (front and back known; the
- * three-quarter and profile turn either way, so the user places them), the sheet itself, and the photos it was made from
- * (the first is the front when nothing else is).
+ * The pictures a finished Character Sheet or Soul Cast result offers: its whole sheets, the views its graph cut (front
+ * and back known; the three-quarter and profile turn either way, so the user places them), and the photos it was made
+ * from (the first is the front when nothing else is). Every picture that isn't a cut view is a whole sheet: the graph's
+ * own, or each variant of a cloud batch, which one generation returns as its outputs. `picked` (a variant the user chose,
+ * by its url or the url it was finished from) comes first, so the dialog starts on it.
*/
-export function sheetPictures(g: Pick<Generation, "outputs" | "request">): TurnPicture[] {
- const out: TurnPicture[] = [];
+export function sheetPictures(g: Pick<Generation, "outputs" | "request">, picked?: string): TurnPicture[] {
const images = g.outputs.filter((o) => o.kind === "image");
const tiles = images.filter((o) => o.meta?.role === "tiles");
- images.forEach((o, i) => {
- if (o.meta?.role === "tiles") {
- const n = tiles.indexOf(o);
- const tile = TILES[typeof o.meta?.index === "number" ? (o.meta.index as number) : n];
- out.push({ url: o.url, label: tile?.label ?? `View ${n + 1}`, ...(tile?.side && { side: tile.side }) });
- } else if (o.meta?.role === "sheet" || i === 0) out.push({ url: o.url, label: "Sheet", sheet: true });
- else out.push({ url: o.url, label: `Picture ${i + 1}` });
+ const sheets = images.filter((o) => o.meta?.role !== "tiles");
+ const isPicked = (o: (typeof images)[number]) => !!picked && (o.url === picked || o.meta?.original === picked);
+ const out: TurnPicture[] = [...sheets.filter(isPicked), ...sheets.filter((o) => !isPicked(o))].map((o) => ({
+ url: o.url,
+ label: sheets.length > 1 ? `Sheet ${sheets.indexOf(o) + 1}` : "Sheet",
+ sheet: true,
+ }));
+ tiles.forEach((o, n) => {
+ const tile = TILES[typeof o.meta?.index === "number" ? (o.meta.index as number) : n];
+ out.push({ url: o.url, label: tile?.label ?? `View ${n + 1}`, ...(tile?.side && { side: tile.side }) });
});
const photos = (g.request.inputs?.images ?? []).filter((u) => u.startsWith("/api/files/"));
const hasFront = out.some((p) => p.side === "front");
@@ -514,6 +527,13 @@ export function planTurnaround(input: TurnaroundInput, ctx: TurnaroundContext =
if (sheet) list.push({ key: "sheet", src: { url: sheet } });
frames = list.map((f) => ({ side: f.key, from: f.key === "sheet" ? "picture" : fromOf(f.src, f.key), ...("url" in f.src && { url: f.src.url }) }));
const { images, chain, after } = gather(list.map((f) => f.src));
+ // The front is the first frame (Image 1 goes as image_url) and the last (end_image_url), so the turn comes back to it.
+ const front = sourceOf("front");
+ const inputs: GenerationRequest["inputs"] = { ...(images.length && { images }), ...(front && "url" in front && { endImage: front.url }) };
+ if (front && "key" in front) {
+ chain.push({ slot: "endImage" });
+ after.push(front.key);
+ }
const max = model.options.maxImages ?? 9;
if (list.length > max) blocker ??= `${model.name} takes up to ${max} references`;
main = {
@@ -527,13 +547,15 @@ export function planTurnaround(input: TurnaroundInput, ctx: TurnaroundContext =
input.prompt,
),
title,
- ...(images.length && { inputs: { images } }),
+ ...(Object.keys(inputs).length && { inputs }),
...(chain.length && { chain }),
params: { numOutputs: 1, duration, resolution: info.resolution, aspectRatio, ...seed },
},
...(after.length && { after }),
};
- notes.push(`${model.name} takes ${list.length === 1 ? "the front view" : `the ${list.length} pictures`} as references and turns the camera from the words: identity holds, the path is loose`);
+ notes.push(
+ `${model.name} takes ${list.length === 1 ? "the front view" : `the ${list.length} pictures`} as references, starts and ends on the front, and turns the camera from the words: identity holds, the path is loose`,
+ );
} else {
const path = input.path && presetKeys(input.path) ? input.path : DEFAULT_PATH;
const keys: CameraKey[] = presetKeys(path)!;
@@ -545,7 +567,7 @@ export function planTurnaround(input: TurnaroundInput, ctx: TurnaroundContext =
feature,
modelId: model.id,
op: "camera-path",
- prompt: withWords(ORBIT_PROMPT, input.prompt),
+ prompt: cameraWords(path, input.prompt),
title,
...(src && "url" in src && { inputs: { images: [src.url] } }),
...(src && "key" in src && { chain: [{ slot: "images" as const }] }),
@@ -610,4 +632,9 @@ export interface TurnaroundPreview {
demo: boolean;
/** The open engine: the most VRAM a step needs (GB). */
gpuGb?: number;
+ /**
+ * A real person (the client says so, or a character, which always is): Soul ID's consent line is asked for, or it is
+ * on file from the character's Soul ID training.
+ */
+ consent?: "asked" | "on-file";
}
diff --git a/tests/turnaround.test.ts b/tests/turnaround.test.ts
index 52290fee..b3f6332b 100644
--- a/tests/turnaround.test.ts
+++ b/tests/turnaround.test.ts
@@ -1,6 +1,7 @@
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
-import { presetKeys } from "@/lib/camera-path";
+import { DEFAULT_MOTION, presetKeys } from "@/lib/camera-path";
import { getModel } from "@/lib/catalog";
+import { estimateCost } from "@/lib/catalog/plan";
import { buildPayload } from "@/lib/catalog/payload";
import { ANGLES_2511_LORA } from "@/lib/catalog/open-tools";
import {
@@ -11,6 +12,7 @@ import {
TURN_SIDES,
WORLDCAST,
anglesHorizontal,
+ cameraWords,
elementPictures,
pathAzimuth,
planTurnaround,
@@ -97,6 +99,25 @@ describe("the pictures a sheet or a character offers", () => {
]);
});
+ it("offers every variant of a cloud batch as a sheet, the picked one first (by its url or the one it was finished from)", () => {
+ // Fuobe Soul makes a Soul Cast batch as one generation with a sheet per variant (the open engine makes one job each).
+ const batch = gen([
+ { url: "/v1.png", kind: "image" },
+ { url: "/v2.png", kind: "image", meta: { original: "/v2-raw.png" } },
+ { url: "/v3.png", kind: "image" },
+ ]);
+ const pics = sheetPictures(batch, "/v2.png");
+ expect(pics).toEqual([
+ { url: "/v2.png", label: "Sheet 2", sheet: true },
+ { url: "/v1.png", label: "Sheet 1", sheet: true },
+ { url: "/v3.png", label: "Sheet 3", sheet: true },
+ ]);
+ expect(startingViews(pics).sheet).toBe("/v2.png");
+ expect(startingViews(sheetPictures(batch, "/v2-raw.png")).sheet).toBe("/v2.png");
+ // Nothing picked: the first variant.
+ expect(startingViews(sheetPictures(batch)).sheet).toBe("/v1.png");
+ });
+
it("takes a character's wide picture as its sheet and the first other one as its front", () => {
const pics = elementPictures([
{ url: "/a.png", width: 2048, height: 1152 },
@@ -184,6 +205,17 @@ describe("the open engine: Frames mode's chain", () => {
});
});
+describe("the camera route's words", () => {
+ it("uses the orbit words only for a level full ring, and N7-5's neutral words for any other move", () => {
+ const words = (path?: string, prompt?: string) => planTurnaround({ engine: "cloud", views: views("front"), ...(path && { path }), ...(prompt && { prompt }) }).steps[0].request.prompt;
+ expect(words()).toBe(ORBIT_PROMPT);
+ expect(words("orbit_360_cw")).toBe(ORBIT_PROMPT);
+ for (const path of ["zoom_in", "zoom_out", "orbit_90_cw", "orbit_90_ccw", "orbit_180_push", "orbit_tilt_20"]) expect(words(path), path).toBe(DEFAULT_MOTION);
+ expect(cameraWords("zoom_in", "slow")).toBe(`${DEFAULT_MOTION}. slow`);
+ expect(cameraWords("orbit_360")).toBe(ORBIT_PROMPT);
+ });
+});
+
describe("the cloud", () => {
it("takes the camera path from a single front view, an exact clockwise orbit by default: $0.40 for 5 s at 768P", () => {
const plan = planTurnaround({ engine: "cloud", views: views("front") });
@@ -203,6 +235,8 @@ describe("the cloud", () => {
const r = plan.steps[0].request;
expect(r).toMatchObject({ modelId: "minimax-h3-max", op: "ref2v", inputs: { images: [V.front, V.right, V.back, V.left] }, params: { duration: 5, resolution: "768P", aspectRatio: "9:16" } });
expect(r.prompt).toMatch(/^Image 1 is the person's front view, Image 2 is their right side, Image 3 is their back, Image 4 is their left side\. The camera orbits 360 degrees/);
+ // It starts and ends on the front: the front is also the last frame.
+ expect(r.inputs?.endImage).toBe(V.front);
// With a sheet: no sides drawn (the sheet shows them), and it is the last reference.
const sheet = planTurnaround({ engine: "cloud", views: views("front", "back"), sheet: SHEET });
expect(sheet.fills).toEqual([]);
@@ -210,6 +244,15 @@ describe("the cloud", () => {
expect(sheet.steps[0].request.prompt).toMatch(/Image 3 is a turnaround sheet of the same person/);
});
+ it("ends on a front drawn from the sheet when no picture shows the front", () => {
+ const plan = planTurnaround({ engine: "cloud", sheet: SHEET });
+ expect(plan.route).toBe("references");
+ const main = plan.steps.at(-1)!;
+ expect(main.request.chain).toEqual([{ slot: "images", at: 0 }, { slot: "endImage" }]);
+ expect(main.after).toEqual(["front", "front"]);
+ expect(main.request.inputs).toEqual({ images: [SHEET] });
+ });
+
it("draws missing sides with Qwen Multiple Angles ($0.035 each) and places them among the references", () => {
const plan = planTurnaround({ engine: "cloud", views: views("front", "back"), fill: true });
expect(plan.steps.map((s) => s.key)).toEqual(["fill-right", "fill-left", "main"]);
@@ -251,6 +294,12 @@ describe("the cloud", () => {
}
});
+ it("prices H3 Max per second by resolution, 2K (extend's alone) at $0.32", () => {
+ const h3 = getModel("minimax-h3-max")!;
+ const at = (resolution: string, op: "ref2v" | "extend") => estimateCost(h3, { duration: 5, resolution }, 1, op);
+ expect([at("480P", "ref2v"), at("768P", "ref2v"), at("1080P", "ref2v"), at("2K", "extend")]).toEqual([0.25, 0.4, 0.8, 1.6]);
+ });
+
it("picks another route when a model is switched off in Settings → Models & licences", () => {
const plan = planTurnaround({ engine: "cloud", views: views("front", "right", "back", "left") }, { has: (id) => id !== "minimax-h3-max" });
expect(plan.routes).toEqual(["keyframes", "camera"]);
@@ -263,10 +312,11 @@ describe("the reference-to-video payload", () => {
const plan = planTurnaround({ engine: "cloud", views: views("front", "right", "back", "left"), sheet: SHEET });
const r = plan.steps[0].request;
const route = getModel("minimax-h3-max")!.routes.find((x) => x.op === "ref2v")!;
- const body = buildPayload(route.map!, { prompt: r.prompt, images: r.inputs?.images, ...(r.params as GenInput) });
+ const body = buildPayload(route.map!, { prompt: r.prompt, images: r.inputs?.images, endImage: r.inputs?.endImage, ...(r.params as GenInput) });
expect(body).toMatchObject({
reference_image_urls: [V.front, V.right, V.back, V.left, SHEET],
image_url: V.front,
+ end_image_url: V.front,
duration: 5,
resolution: "768P",
aspect_ratio: "9:16",