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: Idol 3D quick mesh takes Best or Quick look and the photo crop, and its card waits for the mesh's own turntable

Claude857891db6ce3
diff --git a/src/components/model3d/model3d-studio.tsx b/src/components/model3d/model3d-studio.tsx
index ce7acbf1..e3429e61 100644
--- a/src/components/model3d/model3d-studio.tsx
+++ b/src/components/model3d/model3d-studio.tsx
@@ -30,6 +30,7 @@ import {
VIEW_SIDES,
idolPhotoFor,
isIdol,
+ isIdolMesh,
model3dBlocker,
model3dFor,
model3dRequest,
@@ -62,7 +63,7 @@ export interface Model3dInfo {
const PLACEHOLDER = "/api/files/placeholder.png";
const HINTS: Record<Model3dMode, string> = {
- image: "One clear photo → a textured 3D model (.glb) you can spin, download, rig and animate, record as a turntable and turn into a video.",
+ image: "One clear photo → a 3D model (.glb) you can spin, download, rig and animate, record as a turntable and turn into a video.",
multi: "Photos of the same object from 2–4 sides → one 3D model that's right all the way round.",
text: "Describe one object → a textured 3D model of it.",
objects: "Name something in a photo → just that object, rebuilt in 3D as it stands.",
@@ -238,7 +239,9 @@ export function Model3dStudio({ info }: { info: Record<string, Model3dInfo> }) {
const wanted = picked[`${mode}:${engine}`];
const modelId = model3dFor(mode, engine, wanted && choices.some((m) => m.id === wanted) ? wanted : choices[0]?.id);
const sides = Object.fromEntries(VIEW_SIDES.flatMap((s) => (views[s] ? [[s, views[s]!.ref]] : []))) as Partial<Record<ViewSide, string>>;
- const idol = mode === "splat" && isIdol(modelId);
+ // Idol 3D in Splat, and Idol 3D quick mesh in From an image (Idol's graph runs first): Best or Quick look and the crop.
+ const idolSplat = mode === "splat" && isIdol(modelId);
+ const idol = idolSplat || (mode === "image" && engine === "open" && isIdolMesh(modelId));
const idolQuality = idolQualities[`${mode}:${engine}`] ?? "best";
const setIdolQuality = (q: IdolQuality) => setIdolQualities((p) => ({ ...p, [`${mode}:${engine}`]: q }));
const input: Model3dInput = {
@@ -412,7 +415,7 @@ export function Model3dStudio({ info }: { info: Record<string, Model3dInfo> }) {
{!licence && info[modelId]?.notices.length > 0 && <p className="text-[12px] font-medium">{info[modelId].notices.join(" · ")}</p>}
{licence && licence.notices.length > 0 && <p className="text-[12px] text-muted-foreground">{licence.notices.join(" · ")}</p>}
</div>
- {!idol && (mode === "image" || mode === "multi") && <RefineOption engine={engine} value={refine} onChange={setRefine} openAllowed={refineAllowed} onUseGpu={() => setEngine("open")} />}
+ {!idolSplat && (mode === "image" || mode === "multi") && <RefineOption engine={engine} value={refine} onChange={setRefine} openAllowed={refineAllowed} onUseGpu={() => setEngine("open")} />}
{idol && <IdolSettings quality={idolQuality} onQuality={setIdolQuality} photo={idolPhoto} onPhoto={setIdolPhoto} />}
<Button size="lg" className={cn("mt-4 w-full rounded-full", blocker && "bg-muted text-muted-foreground hover:bg-muted")} onClick={go} disabled={create.isPending || visitor}>
{create.isPending ? <Loader2 className="size-4 animate-spin" /> : <Box className="size-4" />} {mode === "splat" ? "Make the splat" : "Make it 3D"}
@@ -421,7 +424,7 @@ export function Model3dStudio({ info }: { info: Record<string, Model3dInfo> }) {
{visitor ? blocker : <>{blocker ? `${blocker} · ` : ""}{preview.isError ? (preview.error as Error).message : (price ?? "Working out the price…")}</>}
</p>
<p className="mt-1 text-[12px] text-muted-foreground">
- {idol
+ {idolSplat
? engine === "open"
? "Idol cuts the object out, builds the splat and renders an orbit video on your GPU. One object per picture."
: "Idol cuts the object out and builds the splat, ready to download. One object per picture."
diff --git a/src/lib/av/model3d.ts b/src/lib/av/model3d.ts
index e4476b51..07482312 100644
--- a/src/lib/av/model3d.ts
+++ b/src/lib/av/model3d.ts
@@ -84,6 +84,9 @@ export const CLOUD_NOTICES: Record<string, string[]> = { triposplat: ["Built wit
/** Idol 3D on each engine: the open graph (image-to-splat-idol) and fal's speridlabs/idol. */
export const IDOL_MODELS = { open: "oss-idol", cloud: "idol-3d" } as const;
export const isIdol = (id: string | null | undefined) => id === IDOL_MODELS.open || id === IDOL_MODELS.cloud;
+/** Idol 3D quick mesh (From an image, open engine only): Idol's splat graph, then core SplatToMesh into a vertex-coloured GLB. */
+export const IDOL_MESH_MODEL = "oss-idol-mesh";
+export const isIdolMesh = (id: string | null | undefined) => id === IDOL_MESH_MODEL;
export type IdolQuality = "best" | "quick";
@@ -162,9 +165,9 @@ export interface Model3dInput {
views?: Partial<Record<ViewSide, string>>;
/** From text: the object; Pick an object: what to take out. */
prompt?: string;
- /** Splat with Idol 3D: Best (its reference settings, the default) or Quick look. */
+ /** Splat with Idol 3D, or From an image with Idol 3D quick mesh: Best (its reference settings, the default) or Quick look. */
quality?: IdolQuality;
- /** Splat with Idol 3D: the picture is a photo, so the object gets Idol's looser crop. */
+ /** Splat with Idol 3D, or From an image with Idol 3D quick mesh: the picture is a photo, so the object gets Idol's looser crop. */
photoCrop?: boolean;
}
@@ -221,7 +224,8 @@ export function model3dRequest(i: Model3dInput): GenerationRequest {
// Idol 3D gets its Best / Quick look settings and the photo crop; TripoSplat's request is unchanged.
return { ...base, op: "splat", inputs: { images }, ...(isIdol(modelId) && { params: { extra: idolExtra(i.engine, i.quality, !!i.photoCrop) } }) };
default:
- return { ...base, op: "image-to-3d", inputs: { images } };
+ // Idol 3D quick mesh runs Idol's graph first, so it takes the same Best / Quick look settings and photo crop.
+ return { ...base, op: "image-to-3d", inputs: { images }, ...(isIdolMesh(modelId) && i.engine === "open" && { params: { extra: idolExtra("open", i.quality, !!i.photoCrop) } }) };
}
}
@@ -298,8 +302,11 @@ export function model3dView(g: Pick<Generation, "outputs" | "request">): Model3d
const meta = (mesh?.meta ?? {}) as Record<string, unknown>;
const str = (v: unknown) => (typeof v === "string" && v ? v : undefined);
const videos = g.outputs.filter((o) => o.kind === "video");
- const video = videos.find((o) => o.meta?.role === "turntable" || o.meta?.turntable) ?? videos[0];
const finish = (meta.finish ?? {}) as { turntable?: unknown; turntableProgress?: unknown; material?: unknown };
+ // Idol 3D quick mesh's graph brings the splat's orbit, which looks smoother than the mesh: its card shows a turntable
+ // only once the server has rendered the mesh's own (which replaces the orbit), else the poster, and one can be recorded.
+ const orbitOnly = isIdolMesh(g.request.modelId) && finish.turntable !== "done";
+ const video = orbitOnly ? videos.find((o) => o.meta?.turntable === true) : (videos.find((o) => o.meta?.role === "turntable" || o.meta?.turntable) ?? videos[0]);
const pending = finish.turntable === "queued" || finish.turntable === "rendering";
const formats: Record<string, string> = {};
const listed = meta.formats;
diff --git a/src/server/assist/tools.ts b/src/server/assist/tools.ts
index 97a7a983..160b8530 100644
--- a/src/server/assist/tools.ts
+++ b/src/server/assist/tools.ts
@@ -277,7 +277,7 @@ const Job = z.object({
mesh_resolution: z
.union([z.literal(512), z.literal(1024), z.literal(1536)])
.optional()
- .describe("refine-3d: Hi3D's detail, 512 (one pass), 1024 (two, the default) or 1536 (three). On an open image-to-3d model, setting it also refines the model after it is built. The result is geometry only."),
+ .describe("refine-3d: Hi3D's detail, 512 (one pass), 1024 (two, the default) or 1536 (three). On an open image-to-3d model, setting it also refines the model after it is built. The result is geometry only (colours and textures are lost). On oss-idol-mesh too it means that refine step, not a finer Idol mesh: leave it out to keep the vertex colours."),
aspect_ratio: z.string().optional().describe("e.g. 16:9, 9:16, 1:1 — one the model lists."),
resolution: z.string().optional().describe("e.g. 1080p, 2K — one the model lists."),
duration: z.number().optional().describe("Seconds, for video and music — one the model lists."),
diff --git a/tests/idol-mesh.test.ts b/tests/idol-mesh.test.ts
index d379f818..fa8035fc 100644
--- a/tests/idol-mesh.test.ts
+++ b/tests/idol-mesh.test.ts
@@ -137,12 +137,28 @@ describe("Idol 3D quick mesh: the model and From an image", () => {
expect(m3d.MODELS_3D.splat.open.map((x) => x.id)).toEqual(["oss-triposplat", "oss-idol"]);
});
- it("asks for image-to-3d with the photo and plans on the graph; the Idol splat settings stay with Splat", () => {
+ it("asks for image-to-3d with the photo and Idol's Best / Quick look and photo crop, and plans on the graph", async () => {
const req = m3d.model3dRequest({ engine: "open", mode: "image", modelId: "oss-idol-mesh", photo, quality: "quick", photoCrop: true });
- expect(req).toEqual({ feature: "image-to-3d", modelId: "oss-idol-mesh", op: "image-to-3d", inputs: { images: [photo] } });
+ expect(req).toEqual({
+ feature: "image-to-3d",
+ modelId: "oss-idol-mesh",
+ op: "image-to-3d",
+ inputs: { images: [photo] },
+ params: { extra: { steps: 20, sampler: "dpmpp_2m", cfg: 4, numGaussians: 65536, photoCrop: true } },
+ });
+ expect(m3d.model3dRequest({ engine: "open", mode: "image", modelId: "oss-idol-mesh", photo }).params?.extra).toEqual({ ...m3d.IDOL_PRESETS.best, photoCrop: false });
const p = planGeneration(req, getModel, getPreset);
expect(p.model.id).toBe("oss-idol-mesh");
expect(p.op).toBe("image-to-3d");
+ // The settings reach Idol's nodes in the mesh graph.
+ const ctx = { generationId: "gen-mesh", op: "image-to-3d" as const, upload: async () => "x" };
+ const { workflow } = await prepareWorkflow("image-to-mesh-idol", { prompt: "", images: ["p.png"], extra: req.params!.extra }, ctx);
+ expect(workflow["88:6"].inputs).toMatchObject({ steps: 20, sampler_name: "dpmpp_2m" });
+ expect(workflow["88:55"].inputs).toMatchObject({ num_gaussians: 65536 });
+ expect(workflow["88:104"].inputs.switch).toBe(true);
+ // Other From an image models get no Idol settings.
+ expect(m3d.model3dRequest({ engine: "open", mode: "image", modelId: "oss-trellis2", photo, quality: "quick", photoCrop: true }).params).toBeUndefined();
+ expect(m3d.isIdolMesh("oss-idol-mesh") && !m3d.isIdol("oss-idol-mesh")).toBe(true);
});
it("is offered by a Canvas 3D model node", () => {
@@ -154,7 +170,7 @@ describe("Idol 3D quick mesh: the model and From an image", () => {
describe("Idol 3D quick mesh: what a finished job gives", () => {
const history = { status: { status_str: "success", completed: true }, outputs: { "51": { "3d": [file("gen-mesh_00001_.glb")] }, "42": { images: [file("gen-mesh_00001_.mp4")], animated: [true] } } };
- it("comes back as a GLB model (no role, no splat format) and the orbit as the turntable", () => {
+ it("comes back as a GLB model (no role, no splat format), with the orbit kept as a file but not shown as the mesh's turntable", () => {
const outs = collectOutputs(history as never, getWorkflow("image-to-mesh-idol").manifest);
expect(outs.map((o) => [o.kind, o.contentType, o.meta])).toEqual([
["model3d", "model/gltf-binary", undefined],
@@ -164,8 +180,16 @@ describe("Idol 3D quick mesh: what a finished job gives", () => {
const view = m3d.model3dView(g as never);
expect(view.splat).toBeUndefined();
expect(view.glb).toBe(outs[0].url);
- expect(view.turntable).toBe(outs[1].url);
+ // The graph's video is the splat's orbit, smoother than the mesh: not the card's turntable until the server renders the mesh's.
+ expect(view.turntable).toBeUndefined();
expect(view.photo).toBe(photo);
+ const skipped = m3d.model3dView({ ...g, outputs: [{ ...outs[0], meta: { finish: { turntable: "skipped: no Chromium" } } }, outs[1]] } as never);
+ expect(skipped.turntable).toBeUndefined();
+ const mine = { url: "/api/files/turntable.mp4", kind: "video", contentType: "video/mp4", meta: { role: "turntable", fps: 24, frames: 96 } };
+ const done = m3d.model3dView({ ...g, outputs: [{ ...outs[0], meta: { finish: { turntable: "done" } } }, mine] } as never);
+ expect(done.turntable).toBe(mine.url);
+ // Another model's graph turntable still shows (Idol's own splat orbit, TRELLIS.2's).
+ expect(m3d.model3dView({ ...g, request: { ...g.request, modelId: "oss-trellis2" } } as never).turntable).toBe(outs[1].url);
// Once saved, the server finishes the GLB like every image-to-3D route's (a web GLB, and its own turntable of the mesh).
const saved = outs.map((o, i) => ({ ...o, assetId: `a${i}` }));
expect(modelToFinish({ provider: "comfyui", op: "image-to-3d" }, saved as never)).toBe(0);
@@ -178,7 +202,7 @@ describe("Idol 3D quick mesh: what a finished job gives", () => {
expect(hi3d.canRefine({ glb: view.glb, photo: view.photo, splat: view.splat, openAllowed: true })).toBe(true);
expect(hi3d.refineRequest({ glb: view.glb!, photo: view.photo! })).toMatchObject({ modelId: "oss-hi3d-refine", inputs: { model3d: view.glb, images: [photo] } });
const req = hi3d.withRefine(m3d.model3dRequest({ engine: "open", mode: "image", modelId: "oss-idol-mesh", photo }), "open", 512);
- expect(req.params?.extra).toEqual({ hi3dRefine: 512 });
+ expect(req.params?.extra).toEqual({ ...m3d.IDOL_PRESETS.best, photoCrop: false, hi3dRefine: 512 });
});
});