AI media harness for planning, generating, and editing locally
TypeScript
Strengthen Backdrop color instructions
Bittia3d6d913a74d
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex ac3091c..8e1bb82 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -25,6 +25,7 @@ This alpha update adds SeedVR2 and Real-ESRGAN export upscaling, Long Shot and B## Fixes and improvements+- Backdrop prompts describe a flat, constant color field in every shot, limit reference guidance to subject appearance, and use neutral studio styling when no look is specified.- Zoom uses SlopFab's native edge blend directly, avoiding a second feather or color correction when saving. Source transparency is retained.- Generate all includes the final scene in an even-length Long Shot sequence, continuing from the preceding scene and preserving earlier joined video and audio. Four scenes generate in 1 → 3 → 2 → 4 order; adding another scene turns the final continuation into a bridge on its next generation.- Long Shot timeline playback keeps the same video player running across adjacent scenes in a joined generation, avoiding a playback restart at bridge boundaries.diff --git a/src/lib/backdrop.ts b/src/lib/backdrop.tsindex 7021249..421082d 100644--- a/src/lib/backdrop.ts+++ b/src/lib/backdrop.ts@@ -3,5 +3,13 @@ export type BackdropColor = keyof typeof BACKDROP_COLORS;export const BACKDROP_OPTIONS = Object.keys(BACKDROP_COLORS).map((value) => ({ value, label: value[0].toUpperCase() + value.slice(1) }));export function backdropDirection(color: BackdropColor): string {- return `Generate the described subject and action against a uniform, solid ${color} (${BACKDROP_COLORS[color]}) backdrop for background keying. Keep this exact backdrop color consistent across every frame and every shot, filling all space behind the subject. No scenery, floor, horizon, gradients, texture, backdrop shadows or reflections. Light the subject independently, with clear edges and no ${color} color spill. Keep the subject fully inside the frame. Reference images guide the subject's appearance only; replace their backgrounds with this solid backdrop.`;+ return `The video is an isolated-subject compositing plate against a uniform, solid ${color} (${BACKDROP_COLORS[color]}) backdrop. The background is a flat digital color field, edge to edge, with constant color and brightness throughout the video. ${backdropShotDirection(color)} Only the subject has shading and detail; lighting and color grading affect the subject alone. Keep the subject fully inside the frame with clean, distinct edges.${color === "green" || color === "blue" ? ` Keep ${color} spill off the subject.` : ""} No visible scenery, floor, horizon, gradients, texture, backdrop shadows or reflections.`;+}++export function backdropShotDirection(color: BackdropColor): string {+ return `Every area outside the subject's silhouette, including gaps between limbs and newly revealed areas during movement, remains the same solid ${color} (${BACKDROP_COLORS[color]}) in every frame.`;+}++export function backdropSummary(color: BackdropColor): string {+ return `An isolated-subject compositing plate on a uniform, solid ${color} (${BACKDROP_COLORS[color]}) background throughout.`;}diff --git a/src/lib/project.backdrop.test.ts b/src/lib/project.backdrop.test.tsindex 0153766..7a83eb8 100644--- a/src/lib/project.backdrop.test.ts+++ b/src/lib/project.backdrop.test.ts@@ -1,5 +1,5 @@import { expect, it } from "vitest";-import { compileGenerationJobPrompt, createDraftGenerationJob, generationJobSchema, sceneGenerationReferences, type ProjectReference } from "./project";+import { compileGenerationJobPrompt, compileGenerationJobSegments, createDraftGenerationJob, generationJobSchema, sceneGenerationReferences, type ProjectReference } from "./project";import { BACKDROP_COLORS } from "./backdrop";it.each(["green", "blue", "black", "white"] as const)("compiles and preserves a %s backdrop without stale frame anchors", (backdropColor) => {@@ -12,10 +12,54 @@ it.each(["green", "blue", "black", "white"] as const)("compiles and preserves aconst prompt = compileGenerationJobPrompt(job, references);expect(prompt).toContain(`solid ${backdropColor} (${BACKDROP_COLORS[backdropColor]})`);expect(prompt).toContain("A dancer spins.");+ expect(prompt).toContain("neutral studio");+ expect(prompt).not.toContain("cinematic");+ expect(prompt).toContain(`remains the same solid ${backdropColor} (${BACKDROP_COLORS[backdropColor]}) in every frame`);expect(prompt).not.toContain("<Picture");expect(prompt).toBe(compileGenerationJobPrompt(job, sceneGenerationReferences(job, references)));});+it.each(["text", "image", "refmod"])("limits %s reference guidance to appearance and describes the background in every shot", (kind) => {+ const reference: ProjectReference = { id: "subject", name: "Subject", kind: "text", description: kind === "refmod" ? "" : "A red robot in a forest", intendedUse: [], createdAt: "2026-10-09T00:00:00Z",+ ...(kind === "image" ? { images: [{ id: "image", name: "Robot", sourcePath: "C:/robot.png" }] } : {}),+ ...(kind === "refmod" ? { refmods: [{ id: "encoded", name: "Robot", sourcePath: "C:/robot.safetensors", strength: 1, copies: 1 }] } : {}),+ };+ const job = { ...createDraftGenerationJob("", { sceneType: "backdrop" }), shots: [+ { id: "first", startSeconds: 0, action: "@[ref:subject]Walking cycle from side, full body shot." },+ { id: "second", startSeconds: 2, action: "@[ref:subject]'s arms swing." },+ ] };+ const segments = compileGenerationJobSegments(job, [reference]);+ const prompt = segments.map((segment) => segment.value).join("");+ const definitions = prompt.split("\n\nsummary:")[0];+ expect(definitions).toContain("appearance and identity only");+ expect(definitions).toContain("environmental lighting are replaced");+ if (kind === "refmod") {+ expect(definitions).toContain("pre-encoded reference");+ expect(prompt).not.toContain("<Picture");+ }+ expect(prompt).toContain("<Subject 1> Walking cycle");+ expect(prompt).toContain("<Subject 1>'s arms swing.");+ const detailed = prompt.split("detailed_description:\n")[1].split("\n\noverall_soundscape:")[0];+ expect(detailed).toMatch(/^The target video is in a neutral studio style\./);+ for (const shot of detailed.split(/\[Shot \d+\]/).slice(1)) {+ expect(shot).toContain("newly revealed areas during movement");+ expect(shot).toContain("#00ff00");+ }+ const summary = prompt.split("summary:\n")[1].split("\n\nretention_analysis:")[0];+ expect(summary).toMatch(/^\[reference generation\] An isolated-subject compositing plate/);+ expect(summary).not.toContain("No visible scenery");+});++it("preserves chosen and described styles while limiting grading to the subject", () => {+ const job = createDraftGenerationJob("A claymation dancer spins.", { sceneType: "backdrop" });+ expect(compileGenerationJobPrompt(job)).toContain("Claymation");+ const chosen = { ...job, shots: [{ id: "first", startSeconds: 0, action: "A dancer spins.", settings: { visualStyle: ["watercolor"] } }] };+ expect(compileGenerationJobPrompt(chosen)).toContain("Watercolor");+ const prompt = compileGenerationJobPrompt({ ...chosen, shots: [{ ...chosen.shots[0], settings: null }] }, [], "live-action-cinematic");+ expect(prompt).toContain("Live-action, cinematic");+ expect(prompt).toContain("lighting and color grading affect the subject alone");+});+it("uses green by default and retains explicitly cited subject references", () => {const job = createDraftGenerationJob("@[ref:subject] spins.", { sceneType: "backdrop" });const references: ProjectReference[] = [{ id: "subject", name: "Dancer", kind: "text", description: "A red robot", intendedUse: [], createdAt: "2026-10-09T00:00:00Z" }];diff --git a/src/lib/project.ts b/src/lib/project.tsindex 1bb2621..cf469b2 100644--- a/src/lib/project.ts+++ b/src/lib/project.ts@@ -1,6 +1,6 @@import { MIN_SIGMA_SHIFT, MAX_SIGMA_SHIFT } from "./sampling";import { z } from "zod";-import { backdropDirection, type BackdropColor } from "./backdrop";+import { backdropDirection, backdropShotDirection, backdropSummary, type BackdropColor } from "./backdrop";import { createImageScene, imageSceneReferenceIds, imageSceneSchema } from "./imageScene";import { effectEnabledSchema, effectSchemas, isEffectOn } from "./effectSettings";import { normalizeShotTagSelection, shotTagClauses, SHOT_TAG_ID_PATTERN, type ShotTagClauses, type ShotTagSelection } from "./shot-tags";@@ -881,8 +881,8 @@ const STYLE_PATTERNS: ReadonlyArray<readonly [RegExp, string]> = [];const DEFAULT_STYLE = "Live-action, cinematic";-export function deriveH3Style(creativeBrief: string): string {- return STYLE_PATTERNS.find(([pattern]) => pattern.test(creativeBrief))?.[1] ?? DEFAULT_STYLE;+export function deriveH3Style(creativeBrief: string, fallback = DEFAULT_STYLE): string {+ return STYLE_PATTERNS.find(([pattern]) => pattern.test(creativeBrief))?.[1] ?? fallback;}/** Base guide §4.1 spells the canonical style names with deliberate casing —@@ -1413,6 +1413,12 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Projelet text = "";for (const part of splitActionText(shot.action.trim())) {if (part.kind === "text") {+ // Reference chips can touch the following word in the editor. Keep+ // inserted spacing attributed to Slopus, leaving user text intact.+ if (/(?:<Subject \d+>|<Audio \d+>)$/.test(text) && /^[\p{L}\p{N}]/u.test(part.value)) {+ body.push(frame(" "));+ text += " ";+ }body.push(own(part.value));text += part.value;continue;@@ -1460,7 +1466,7 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Proje// retain the guess from the user's own words, marked as Slopus's doing.const styleFromTag = compiled.map((shot) => shot.tags.style).find((style) => Boolean(style))?? (defaultLook ? shotTagClauses({ visualStyle: [defaultLook] }).style : null);- const style = styleFromTag ?? deriveH3Style(compiled.map((shot) => shot.text).join(" "));+ const style = styleFromTag ?? deriveH3Style(compiled.map((shot) => shot.text).join(" "), scene.backdropColor ? "neutral studio" : DEFAULT_STYLE);const styleSegment = styleFromTag ? tagged(style) : frame(style);/** The `[Shot N]` marker. Shot 1 never carries a timestamp (base guide §4.2);@@ -1502,6 +1508,7 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Projeconst music = (scene.music ?? "").trim();const soundSegment = sound ? own(sound) : frame(DEFAULT_SOUNDSCAPE);const musicSegment = music ? own(music) : frame(DEFAULT_MUSIC);+ const backdropShot = scene.backdropColor ? [frame(` ${backdropShotDirection(scene.backdropColor)}`)] : [];if (usable.length === 0 && sounds.length === 0 && !startFrame && !endFrame) {// T2VA — base guide §2.2 field list and order.@@ -1515,8 +1522,9 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Proje// subject and its action....(shot.tags.framing.length > 0 ? [tagged(shot.tags.framing.join(", ")), frame(", ")] : []),...shot.body,- ...stop(shot),+ ...(scene.backdropColor ? addedStop(shot.text) : stop(shot)),...tail(shot),+ ...backdropShot,...dialogue(shot, shot.text.length > 0 || shot.tags.clauses.length > 0),]),frame("\n\noverall_soundscape: "),@@ -1555,17 +1563,19 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Projeconst video = videoNumbers.get(reference.id);const label = referenceLabel(reference, index);const lead = index === 0 ? "" : "\n";+ const scope = scene.backdropColor ? [frame(" Use this reference for the subject's appearance and identity only; its background, scenery and environmental lighting are replaced by the target backdrop.")] : [];if (reference.id === scene.poseVideoReferenceId && video) {return [frame(`${lead}${label} is pose and motion guidance from <Video ${video}>. Use its body positions, movement and timing; the prompt and other references define the target subject and setting.`)];}if (!detail && pictures.length === 0 && !video && activeReferenceRefmods(reference).length) {- return [frame(`${lead}${label} uses the attached pre-encoded reference.`)];+ return [frame(`${lead}${label} uses the attached pre-encoded reference.`), ...scope];}- if (pictures.length === 0 && !video) return [frame(`${lead}${label}: `), own(detail), ...addedStop(detail)];+ if (pictures.length === 0 && !video) return [frame(`${lead}${label}: `), own(detail), ...addedStop(detail), ...scope];const pictureList = listOf([...pictures.map((picture) => `<Picture ${picture}>`), ...(video ? [`<Video ${video}>`] : [])]);return [frame(`${lead}${label} is the content shown in ${pictureList}.`),...(detail ? [frame(" "), own(detail), ...addedStop(detail)] : []),+ ...scope,];});// Ref guide §2.4: a sound is its own <Audio N> item, defined by its role.@@ -1611,6 +1621,7 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Projeframe(scene.videoTransition === "extend" ? "[video continuation] Continue from the final frame of <Video 1>. ": scene.videoTransition === "bridge" ? "[video continuation + reference generation] Generate the missing segment after <Video 1> and before <Video 2>. " : `[reference generation${audioTask}] `),...(poseDirection ? [frame(poseDirection)] : []),+ ...(scene.backdropColor ? [frame(`${backdropSummary(scene.backdropColor)} `)] : []),...compiled.flatMap((shot) => [...(shot.index === 0 ? [] : [frame(" ")]),...shot.body,@@ -1651,6 +1662,7 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Projeframe("The target video is in a "),styleFromTag ? tagged(midSentenceStyle(style)) : frame(midSentenceStyle(style)),frame(" style.\n"),+ ...(scene.backdropColor ? [frame(`${backdropDirection(scene.backdropColor)}\n`)] : []),...(poseDirection ? [frame(`${poseDirection.trim()}\n`)] : []),...(scene.videoTransition ? [frame(scene.videoTransition === "extend"? "Begin immediately after the final frame of <Video 1>, continuing its subject identity, pose, motion, lighting and camera trajectory. Follow the text direction below. Output only the new continuation; do not replay the source clip.\n"@@ -1666,6 +1678,7 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Proje? [frame(` The shot features ${listOf(featured[shot.index].map((id) => `<Subject ${subjectNumber.get(id)}>`))}, matching the definitions above.`)]: []),...tail(shot),+ ...backdropShot,...dialogue(shot, shot.text.length > 0 || featured[shot.index].length > 0 || shot.tags.clauses.length > 0),...(shot.index === 0 && startPicture ? [frame(` The opening frame matches <Picture ${startPicture}>.`)] : []),...(shot.index === compiled.length - 1 && endPicture ? [frame(` The closing frame matches <Picture ${endPicture}>.`)] : []),@@ -1681,12 +1694,10 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Proje...definitions,frame("\n\nsummary:\n"),...summary,- ...(scene.backdropColor ? [frame(` ${backdropDirection(scene.backdropColor)}`)] : []),frame(`\n\nretention_analysis:\n${retention.join("\n")}`),...(scene.videoTransition ? [frame("\n<Video 1>: partially_preserved - continue from its ending state without copying its completed action."),...(scene.videoTransition === "bridge" ? [frame("\n<Video 2>: partially_preserved - approach its opening state with continuous motion; do not repeat the ending clip.")] : [])] : []),frame("\n\ndetailed_description:\n"),- ...(scene.backdropColor ? [frame(`${backdropDirection(scene.backdropColor)}\n`)] : []),...detailed,frame("\n\noverall_soundscape:\n"),soundSegment,