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
Exact orbits: the owner's switch, Cinema's numbers follow the move, a short phone price and the path in words
Claude8f179bd53c89
diff --git a/src/components/cinema/draft.ts b/src/components/cinema/draft.tsindex 5895f42d..cba05564 100644--- a/src/components/cinema/draft.ts+++ b/src/components/cinema/draft.ts@@ -4,6 +4,11 @@ import { takesExact, type ExactOrbit } from "@/lib/exact-orbit";/** The prompt bar's state (lifted into the workspace so the AI Director and tiles can fill it). */+/** A new move list: the Exact numbers belong to the first move, so a different first move starts from its own defaults. */+export function withMoves(d: Pick<CinemaDraft, "moves">, moves: string[]): Pick<CinemaDraft, "moves" | "exact"> | Pick<CinemaDraft, "moves"> {+ return moves[0] === d.moves[0] ? { moves } : { moves, exact: null };+}+export interface RefItem {id: string;/** /api/files URL once uploaded ("" while uploading). */diff --git a/src/components/cinema/prompt-bar.tsx b/src/components/cinema/prompt-bar.tsxindex dd83aefc..87822c99 100644--- a/src/components/cinema/prompt-bar.tsx+++ b/src/components/cinema/prompt-bar.tsx@@ -43,7 +43,7 @@ import { PromptInput, ELEMENT_ICONS, type PromptInputHandle } from "@/componentsimport { ShotsEditor } from "@/components/studio/shots-editor";import { ResponsivePanel } from "@/components/studio/responsive-panel";import { useEdgeFade } from "@/components/studio/use-edge-fade";-import { uploadFile, useAssets, useModelAccess, useStatus } from "@/lib/api";+import { uploadFile, useAssets, useIsOwner, useModelAccess, useStatus } from "@/lib/api";import { offered } from "@/lib/model-access";import { getModel } from "@/lib/catalog";import {@@ -73,7 +73,7 @@ import { MoveChips, MovePicker, prefetchMoves } from "./camera-moves";import { ExactOrbitControls } from "@/components/exact-orbit-controls";import { exactDefaults, takesExact } from "@/lib/exact-orbit";import { CameraChip, EmotionChip, FilmSetupChip, LightingChip, PaletteChip } from "./director-panel";-import { directorPicks, draftToInput, type BarAction, type CinemaDraft, type RefItem } from "./draft";+import { directorPicks, draftToInput, withMoves, type BarAction, type CinemaDraft, type RefItem } from "./draft";import { useCinemaGenerate } from "./hooks";import { firstFrame, mediaDuration } from "./media";import { formatUsd } from "./money";@@ -386,6 +386,8 @@ export function PromptBar(props: PromptBarProps) {// Reference clips make the take reference-to-video: the first image is then a reference, not the start frame.const refMode = plan.steps.find((s) => s.key === "main")?.request.op === "ref2v";const video = draft.mode === "video";+ // Exact orbits start with a 3D depth step and run on the studio's own GPU: the owner's for now.+ const owner = useIsOwner();const action = input.action;const busy = generate.isPending || preparing;// The take's length: the main clip, plus what an extend adds (Fuobe Cinema past 20 s in the cloud).@@ -682,8 +684,8 @@ export function PromptBar(props: PromptBarProps) {{!draft.refs.length && <span className="hidden text-[12px] text-muted-foreground sm:inline">Start frame, references, clips or audio — or @ a character</span>}</div>- {video && <MoveChips moves={draft.moves} onChange={(moves) => setDraft({ moves })} />}- {video && action === "generate" && takesExact(draft.moves[0]) && (+ {video && <MoveChips moves={draft.moves} onChange={(moves) => setDraft(withMoves(draft, moves))} />}+ {video && owner && action === "generate" && takesExact(draft.moves[0]) && (<div className="px-2 pb-1.5"><ExactOrbitControls compact engine={engine} value={draft.exact ?? null} defaults={exactDefaults(draft.moves[0])} onChange={(exact) => setDraft({ exact })} /></div>@@ -846,7 +848,7 @@ export function PromptBar(props: PromptBarProps) {}}engine={engine}selected={draft.moves}- onPick={(slug) => setDraft((d) => ({ moves: [...d.moves, slug] }))}+ onPick={(slug) => setDraft((d) => withMoves(d, [...d.moves, slug]))}/>)}diff --git a/src/components/cinema/workspace.tsx b/src/components/cinema/workspace.tsxindex 159b9bce..565c6b4a 100644--- a/src/components/cinema/workspace.tsx+++ b/src/components/cinema/workspace.tsx@@ -359,7 +359,7 @@ function Workspace({ data, items, loading }: { data: ProjectView; items: CinemaGscenePrice,};const onLoadShot = (shot: DirectorShot) => {- setDraft({ mode: "video", prompt: shot.prompt, moves: shot.moves, duration: shot.duration, source: null, action: "generate", multiShot: { mode: "off", shots: [] } });+ setDraft({ mode: "video", prompt: shot.prompt, moves: shot.moves, exact: null, duration: shot.duration, source: null, action: "generate", multiShot: { mode: "off", shots: [] } });if (Object.keys(shot.settings).length) onSettings(shot.settings);toast("Shot loaded — review it, then press Generate", { duration: 2500 });if (!xl) setPanel(null);diff --git a/src/components/fly-around-run.ts b/src/components/fly-around-run.tsindex 51af796e..402f24b3 100644--- a/src/components/fly-around-run.ts+++ b/src/components/fly-around-run.ts@@ -44,10 +44,10 @@ async function post<T>(url: string, body: unknown): Promise<T> {}/** The price line: "Free · on your GPU" on the open engine, the list price in the cloud. */-export function flyPrice(p: FlyAroundPreview | undefined): string {+export function flyPrice(p: FlyAroundPreview | undefined, compact = false): string {if (!p) return "";- if (p.demo) return "Placeholder · free";- if (p.engine === "open") return "Free · on your GPU";+ if (p.demo) return compact ? "Placeholder" : "Placeholder · free";+ if (p.engine === "open") return compact ? "Free" : "Free · on your GPU";return p.costUsd != null ? `≈ ${formatCost(p.costUsd)}` : "";}@@ -69,5 +69,5 @@ export function useFlyAround(body: FlyAroundBody | null) {},onError: (e) => toastError(e),});- return { preview, run, price: flyPrice(preview.data) };+ return { preview, run, price: flyPrice(preview.data), compactPrice: flyPrice(preview.data, true) };}diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsxindex 38c28cfd..fca77adc 100644--- a/src/components/studio/composer.tsx+++ b/src/components/studio/composer.tsx@@ -21,7 +21,7 @@ import { quoteBody, useHostedQuote, useSettled, type RunOn } from "@/lib/hosted"import { ExactOrbitControls } from "@/components/exact-orbit-controls";import { useFlyAround } from "@/components/fly-around-run";import { exactDefaults, takesExact, type ExactOrbit } from "@/lib/exact-orbit";-import { CONNECT_GPU_EVENT, enhance, useClipFacts, useCreateGeneration, useElements, useEngine, useHydrated, useStatus } from "@/lib/api";+import { CONNECT_GPU_EVENT, enhance, useClipFacts, useCreateGeneration, useElements, useEngine, useHydrated, useIsOwner, useStatus } from "@/lib/api";import { usePagePlace } from "@/components/gpu/use-page-place";import { applyMentions, elementsNote, type StudioElement } from "@/lib/catalog/elements";import { applySketch, stripMotionPaths } from "@/lib/catalog/sketch";@@ -348,7 +348,9 @@ export function Composer({ docked }: { docked: boolean }) {const preset: Preset | undefined = draft.presetId && !takesLook ? catalog.getPreset(draft.presetId) : config.preset;const lockedModel = preset?.type === "app";// Fuobe DoP's orbit moves (N7-7): the Exact switch films the orbit by its numbers through /api/fly-around.- const exactId = preset?.type === "motion" && takesExact(preset.id) ? preset.id : undefined;+ // It starts with a 3D depth step and runs on the studio's own GPU: the owner's for now.+ const owner = useIsOwner();+ const exactId = owner && preset?.type === "motion" && takesExact(preset.id) ? preset.id : undefined;const [exactBy, setExactBy] = useState<{ id: string; orbit: ExactOrbit } | null>(null);const exact = exactId && exactBy?.id === exactId ? exactBy.orbit : null;const exactImage = draft.slots.image?.ref;@@ -1507,7 +1509,7 @@ export function Composer({ docked }: { docked: boolean }) {<Tooltip><TooltipTrigger asChild><span className="shrink-0 text-[12px] font-medium text-muted-foreground tabular-nums">- <span className="sm:hidden">{poolPrice || exactPrice ? costText : costLabel({ demo, cost, compact: true, unknown: loraPriceUnknown }, formatCost)}</span>+ <span className="sm:hidden">{exactPrice ? fly.compactPrice : poolPrice ? costText : costLabel({ demo, cost, compact: true, unknown: loraPriceUnknown }, formatCost)}</span><span className="hidden sm:inline">{costText}{payerText}diff --git a/src/lib/catalog/canvas.ts b/src/lib/catalog/canvas.tsindex 83fd1088..f76261dd 100644--- a/src/lib/catalog/canvas.ts+++ b/src/lib/catalog/canvas.ts@@ -1338,8 +1338,13 @@ function concatRequest(graph: CanvasGraph, n: CanvasNode, model: ModelDef): Node/** A Camera path node's keys (a preset, an exact orbit or keys) and their words; none when it has nothing set. */export function cameraPathOf(n: Pick<CanvasNode, "data">): { keys: CameraKey[]; label: string } {+ return flyKeys(pathInputOf(n));+}++/** What a Camera path node holds, as the planner takes it: the orbit's numbers, a preset, or keys. */+function pathInputOf(n: Pick<CanvasNode, "data">) {const d = n.data;- return flyKeys(d.orbit ? { orbit: d.orbit } : d.pathPreset ? { preset: d.pathPreset } : { keys: d.keys });+ return d.orbit ? { orbit: d.orbit } : d.pathPreset ? { preset: d.pathPreset } : { keys: d.keys };}/**@@ -1379,7 +1384,8 @@ function flyAroundRequest(graph: CanvasGraph, n: CanvasNode, model: ModelDef): Nengine: model.engine,image: urlOf(pictures[0]),views: pictures.slice(1).map(urlOf),- keys,+ // The node's own numbers or move (not only its keys): with views, the cloud turns the camera from their words.+ ...pathInputOf(pathNode),prompt: words.join(". ") || undefined,duration: n.data.duration,resolution: n.data.params?.resolution,diff --git a/src/lib/catalog/fly-around.ts b/src/lib/catalog/fly-around.tsindex 52c23705..4f27086d 100644--- a/src/lib/catalog/fly-around.ts+++ b/src/lib/catalog/fly-around.ts@@ -12,7 +12,7 @@* Pure: the browser prices it, the server runs the same steps (src/server/fly-around.ts).*/-import { DEFAULT_MOTION, MAX_KEYS, PATH_FPS, PATH_FRAMES, normalizeKeys, presetKeys, toH3MaxTrajectory, type CameraKey } from "@/lib/camera-path";+import { DEFAULT_MOTION, MAX_KEYS, PATH_FPS, PATH_FRAMES, PATH_PRESETS, normalizeKeys, presetKeys, toH3MaxTrajectory, type CameraKey } from "@/lib/camera-path";import { exactOrbitKeys, exactSummary, exactWords, type ExactOrbit } from "@/lib/exact-orbit";import { getModel, getPreset } from "./index";import { onEngine } from "./engines";@@ -78,6 +78,16 @@ export function flyKeys(input: Pick<FlyAroundInput, "orbit" | "preset" | "keys">const tidy = (p: string | undefined) => (p ?? "").trim();+/** The path in words, for a model that turns the camera from words (H3 Max reference-to-video): the orbit's numbers or the move. */+export function pathWords(input: Pick<FlyAroundInput, "orbit" | "preset">): string {+ if (input.orbit) return exactWords(input.orbit);+ const move = input.preset && PATH_PRESETS.find((p) => p.id === input.preset);+ if (move) return `The camera moves: ${move.name}, ${move.description.charAt(0).toLowerCase()}${move.description.slice(1)}`;+ const sweep = input.preset && /^orbit_(\d+(?:\.\d+)?)(?:_(cw|ccw))?$/.exec(input.preset);+ if (sweep) return exactWords({ degrees: Number(sweep[1]), direction: sweep[2] === "cw" ? "cw" : "ccw" });+ return "The camera flies around the subject";+}+function stepCost(req: GenerationRequest, engine: Engine): number | null {const lookup = (id: string) => {const m = getModel(id);@@ -134,7 +144,7 @@ export function planFlyAround(input: FlyAroundInput): FlyAroundPlan {const max = model.options.maxImages ?? 9;const images = image ? [image, ...views].slice(0, max) : views.slice(0, max);if (1 + views.length > max) notes.push(`${model.name} takes up to ${max} pictures: the rest are left out`);- const words = input.orbit ? exactWords(input.orbit) : "The camera flies around the subject";+ const words = pathWords(input);steps.push({key: "main",request: {diff --git a/src/lib/exact-orbit.ts b/src/lib/exact-orbit.tsindex 2308e3b6..14022a41 100644--- a/src/lib/exact-orbit.ts+++ b/src/lib/exact-orbit.ts@@ -17,7 +17,7 @@ export interface ExactOrbit {degrees: number;/** Seen from above: counter-clockwise moves the camera round to the right (camera-path's + azimuth). */direction: OrbitDirection;- /** Degrees the ring is tilted (0 = level): it rises on the way round and comes back level. */+ /** Degrees the ring is tilted (0 = level) about the line of sight: it rises over the first half turn and dips below over the second. */tilt: number;/** How far the camera moves in and out on the way round (0 or 0.25 = 25% closer, twice). */pulse: number;@@ -99,12 +99,20 @@ export function exactSummary(input: Partial<ExactOrbit>): string {return [`${o.degrees}° ${DIRECTION_NAMES[o.direction].toLowerCase()}`, o.tilt ? `tilt ${o.tilt}°` : "level", ...(o.pulse ? [`pulse ${Math.round(o.pulse * 100)}%`] : [])].join(" · ");}+/** Where a tilted ring takes the camera's height over `degrees` (elevation = asin(sin tilt · sin turned)). */+function tiltPath(degrees: number): string {+ if (degrees <= 90) return "rises as it goes";+ if (degrees <= 180) return "rises above eye level and comes back down";+ if (degrees < 360) return "rises above eye level, then dips below it";+ return "rises above eye level, dips as far below it and comes back to eye level";+}+/** Words for a model that reads the path from the prompt (the cloud's reference route): where the camera goes. */export function exactWords(input: Partial<ExactOrbit>): string {const o = normalizeExact(input);const way = o.direction === "ccw" ? "to the right" : "to the left";const how = o.degrees >= 360 ? "a full 360-degree orbit" : `a ${o.degrees}-degree arc`;- const tilt = o.tilt ? `, the ring tilted ${o.tilt} degrees so the camera rises and comes back to eye level` : ", at a constant height";+ const tilt = o.tilt ? `, the ring tilted ${o.tilt} degrees so the camera ${tiltPath(o.degrees)}` : ", at a constant height";const pulse = o.pulse ? ", moving in and out twice on the way" : "";return `The camera makes ${how} around the subject, moving ${way}${tilt}${pulse}, keeping the subject centered`;}diff --git a/src/server/assist/studio-tools.ts b/src/server/assist/studio-tools.tsindex e85eda8a..d29591f8 100644--- a/src/server/assist/studio-tools.ts+++ b/src/server/assist/studio-tools.ts@@ -785,7 +785,7 @@ export const FlyAroundToolInput = z.object({.describe(`A ready move: ${PATH_PRESETS.map((p) => `${p.id} (${p.name})`).join(", ")}. Leave it out to give the orbit's numbers instead.`),degrees: z.number().min(30).max(360).optional().describe("An exact orbit: how far round the subject, 30–360° (default 360)."),direction: z.enum(["cw", "ccw"]).optional().describe("An exact orbit's direction seen from above: cw moves the camera round to the left, ccw to the right (default ccw)."),- tilt: z.number().min(0).max(20).optional().describe("An exact orbit's height tilt, 0–20°: the ring rises on the way round and comes back level."),+ tilt: z.number().min(0).max(20).optional().describe("An exact orbit's height tilt, 0–20°: the ring rises over the first half turn and dips below eye level over the second."),pulse: z.boolean().optional().describe("An exact orbit moves 25% in and out twice on the way round."),prompt: z.string().max(1500).optional().describe("Motion words: what the subject does while the camera moves (the camera's own move is set by the path)."),duration: z.number().min(1).max(15).optional().describe("Cloud only: seconds (default 5). Your GPU always films about 5 s."),diff --git a/tests/fly-around.test.ts b/tests/fly-around.test.tsindex 793b7f56..a522ca11 100644--- a/tests/fly-around.test.ts+++ b/tests/fly-around.test.ts@@ -124,6 +124,18 @@ describe("the fly-around plan", () => {expect(p.steps[0].request.prompt).toMatch(/180-degree arc around the subject, moving to the left/);});+ it("puts a preset or a sweep into words for the reference route, and says where a tilted ring takes the camera", () => {+ expect(fly.pathWords({ preset: "orbit_90_cw" })).toMatch(/^The camera moves: Arc 90° left/);+ expect(fly.pathWords({ preset: "orbit_45_ccw" })).toMatch(/45-degree arc around the subject, moving to the right/);+ expect(fly.pathWords({})).toBe("The camera flies around the subject");+ expect(exact.exactWords({ degrees: 90, tilt: 10 })).toMatch(/camera rises as it goes/);+ expect(exact.exactWords({ degrees: 180, tilt: 10 })).toMatch(/rises above eye level and comes back down/);+ expect(exact.exactWords({ degrees: 270, tilt: 10 })).toMatch(/then dips below it/);+ expect(exact.exactWords({ degrees: 360, tilt: 10 })).toMatch(/dips as far below it and comes back to eye level/);+ // The keys agree: below eye level past half a turn.+ expect(Math.min(...exact.exactOrbitKeys({ degrees: 270, tilt: 10 }).map((k) => k.elevation))).toBeLessThan(0);+ });+it("asks for the still and a path", () => {expect(fly.planFlyAround({ engine: "cloud", orbit }).blocker).toBe("Add the still to film");expect(fly.planFlyAround({ engine: "open", image }).blocker).toBe("Pick a path first");@@ -231,6 +243,22 @@ describe("Cinema's Director: an orbit move with the Exact switch", () => {});});+describe("the prompt bars", () => {+ it("Cinema starts a new first move from its own numbers, and keeps them when only later moves change", async () => {+ const { withMoves } = await import("@/components/cinema/draft");+ expect(withMoves({ moves: ["drone-orbit"] }, ["arc-left"])).toEqual({ moves: ["arc-left"], exact: null });+ expect(withMoves({ moves: ["drone-orbit"] }, ["drone-orbit", "dolly-in"])).toEqual({ moves: ["drone-orbit", "dolly-in"] });+ });++ it("a phone's price line is short", async () => {+ const { flyPrice } = await import("@/components/fly-around-run");+ const open = { engine: "open", demo: false, costUsd: 0 } as never;+ expect(flyPrice(open)).toBe("Free · on your GPU");+ expect(flyPrice(open, true)).toBe("Free");+ expect(flyPrice({ engine: "cloud", demo: true } as never, true)).toBe("Placeholder");+ });+});+describe("Image to 3D: Film it photoreal", () => {it("films the photo round the model: the model's render on your GPU, H3 Max's keyframes in the cloud", async () => {const m3d = await import("@/lib/av/model3d");@@ -289,6 +317,11 @@ describe("Canvas: the Camera path and Fly around nodes", () => {expect(cloud.error).toBeUndefined();expect(cloud.steps!.map((s) => [s.request.modelId, s.request.op])).toEqual([["minimax-h3-max", "ref2v"]]);expect(cloud.steps![0].request.inputs?.images).toEqual(["/api/files/uploads/still.png", "/api/files/uploads/back.png"]);+ // The Camera path's own numbers reach the words H3 Max turns the camera from.+ expect(cloud.steps![0].request.prompt).toMatch(/180-degree arc around the subject, moving to the right/);+ const preset = graph("minimax-h3-max-camera", {});+ preset.nodes[2] = node("path", "camera-path", 0, 200, { pathPreset: "orbit_tilt_20" });+ expect(c.describeNode(preset as never, preset.nodes[3] as never).steps![0].request.prompt).toMatch(/^The camera moves: Tilted ring, a full ring tilted 20°/);const g = graph("oss-uni3c-path", { type: "model" });const open = c.describeNode(g as never, g.nodes[3] as never);expect(open.error).toBeUndefined();