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
Cinema 3D scene: clean camera numbers for the re-render, and a binding test of the open one
Claude77e77e2691ee
diff --git a/src/lib/scene3d.ts b/src/lib/scene3d.tsindex 063d7275..95100e4d 100644--- a/src/lib/scene3d.ts+++ b/src/lib/scene3d.ts@@ -24,7 +24,8 @@ export const SENSOR = { width: 36, height: 24 } as const;const DEG = Math.PI / 180;const clamp = (n: number, lo: number, hi: number) => Math.max(lo, Math.min(hi, n));-const round = (n: number, step = 0.1) => Math.round(n / step) * step;+// Divided by the whole number of steps per unit, so 78 steps of 0.1 come out as 7.8, not 7.800000000000001.+const round = (n: number, step = 0.1) => Math.round(n / step) / Math.round(1 / step);/** "16:9" → 1.777…; anything unreadable is square. */export function ratioOf(aspect: string): number {diff --git a/tests/scene3d-provider.test.ts b/tests/scene3d-provider.test.tsindex 3cae2ffa..c3134071 100644--- a/tests/scene3d-provider.test.ts+++ b/tests/scene3d-provider.test.ts@@ -81,6 +81,41 @@ describe("open engine: MoGe 2 scene (scene-mesh-moge)", () => {});});+describe("open engine: the recomposition on Qwen-Image-Edit 2511 (qwen-image-edit-2511-multi)", () => {+ it("binds the capture as image 1, the still as image 2, the Multiple-Angles LoRA and the camera words", async () => {+ const { planCinema } = await import("@/lib/catalog/cinema");+ const plan = planCinema(+ {+ engine: "open",+ mode: "image",+ action: "recompose",+ prompt: "",+ settings: {},+ aspectRatio: "16:9",+ source: { url: "/api/files/uploads/still.png", kind: "image" },+ capture: { url: "/api/files/uploads/capture.png", lens: 50, aperture: 2.8, pose: { horizontal: 300, vertical: 0, zoom: 5 } },+ },+ { higgsfield: false },+ );+ const req = plan.steps[0].request;+ const route = getModel(req.modelId!)!.routes[0];+ expect(route.endpoint).toBe("qwen-image-edit-2511-multi");+ const { workflow } = await prepareWorkflow(route.endpoint, { prompt: req.prompt, images: ["capture.png", "still.png"], loras: req.loras, aspectRatio: "16:9" }, {+ generationId: "gen-recompose",+ op: "edit",+ upload: async (_d, _t, name) => `up_${name}`,+ });+ expect(workflow["41"].inputs.image).toBe("capture.png");+ expect(workflow["83"].inputs.image).toBe("still.png");+ // No third reference: the still again, which the Qwen edit encoder takes harmlessly.+ expect(workflow["1201"].inputs.image).toBe("still.png");+ const lora = Object.values(workflow).find((n) => n.class_type === "LoraLoaderModelOnly");+ expect(lora?.inputs).toMatchObject({ lora_name: "qwen-image-edit-2511-multiple-angles-lora.safetensors", strength_model: 1 });+ expect(String(workflow["170:151"].inputs.prompt)).toMatch(/^<sks> front-left quarter view eye-level shot medium shot\. Re-render this exact camera view/);+ expect(String(workflow["170:151"].inputs.prompt)).toContain("a 50 mm standard lens at f/2.8");+ });+});+describe("cloud: Marigold V2 depth (fal-ai/marigold-v2)", () => {const m = getModel("marigold-depth") as ModelDef;const route = m.routes[0] as ModelRoute;diff --git a/tests/scene3d.test.ts b/tests/scene3d.test.tsindex c531a138..cc5930bd 100644--- a/tests/scene3d.test.ts+++ b/tests/scene3d.test.ts@@ -239,6 +239,15 @@ describe("the captured camera → a recomposition", () => {expect(poseWords({ horizontal: 200, vertical: -25, zoom: 1 })).toBe("back view low-angle shot wide shot");});+ it("sends clean numbers: whole degrees and one decimal of zoom, with no float noise", () => {+ for (let z = -2.5; z <= 2.5; z += 0.13) {+ const p = scenePose({ position: [0.37 * z, 0.21, z], yaw: 0.3, pitch: -0.1 }, 35, 24, 3);+ expect(String(p.zoom)).toMatch(/^\d+(\.\d)?$/);+ expect(String(p.vertical)).toMatch(/^-?\d+(\.\d)?$/);+ expect(Number.isInteger(p.horizontal)).toBe(true);+ }+ });+it("asks to re-render the exact view with the photo's look, the lens and the user's note", () => {const p = recomposePrompt(85, 1.4, "make it dusk.");expect(p).toMatch(/^Re-render this exact camera view of the scene photorealistically\./);