Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Validate and polish grading editors

Bitti3b8cbfc117b9
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 09aedcf..007b6e1 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -4,6 +4,10 @@ This alpha update adds DMAD LoRA support, resumable model downloads, and improve
## What's new
+- Renamed Colour correction to Basic Corrections and added temperature, tint, highlights, shadows, whites and blacks alongside exposure, contrast and saturation.
+- Added Creative with eight built-in procedural looks and intensity, faded film, sharpen and vibrance controls; RGB and hue/saturation/luma curve editors; and shadow, midtone and highlight Color Wheels with individual lightness controls.
+- Vignette now includes midpoint, roundness and feather, plus negative amounts for lighter edges. Grading settings are saved with the project and applied consistently in preview and export.
+
- First and last scene frames use the searchable reference picker with image thumbnails. Reference selectors and prompt chips share configurable filters for images, audio, video, text, and RefMods.
- Configure a character sheet from the Image toolbar's Template menu, with one reference-enabled prompt for clothing and other details, a resolution selection controlling sheet height (512–2048 px), and step count and seed controls, then select Execute. A square waist-up shot and three 9:16 full-body views are combined into one child image in the image bar. The front view provides a shared clothing reference for the other views; all four views share the selected step count and seed.
- Continue scenes from a selected scene's saved latents, with adjustable overlap and a choice of beginning or end. This replaces Previous scene in First & last frame.
diff --git a/docs/video-effects.md b/docs/video-effects.md
index c7ab61f..3e07808 100644
--- a/docs/video-effects.md
+++ b/docs/video-effects.md
@@ -7,11 +7,24 @@ Each effect can be adjusted or removed independently. Locked tracks cannot be ed
| --- | --- |
| Sharpen | Edge enhancement, 0–200%; zero bypasses sharpening. |
| Gaussian Blur | Radius, 0–24 source pixels; zero bypasses blur. |
-| Color Correction | Exposure −4 to +4, contrast −100 to +100%, saturation 0–200%. Saturation zero produces monochrome. |
-| Vignette | Edge darkening, 0–100%. |
+| Basic Corrections | Temperature, tint, highlights, shadows, whites and blacks −100 to +100%; exposure −4 to +4 stops; contrast −100 to +100%; saturation 0–200%. The existing brightness control remains available. |
+| Creative | Eight procedural looks at 0–100% intensity, faded film 0–100%, sharpen 0–200%, and vibrance −100 to +100%. |
+| Curves | RGB master and individual red, green and blue channels; hue vs saturation, hue vs hue, hue vs luma, luma vs saturation, and saturation vs saturation. |
+| Color Wheels | Shadow, midtone and highlight tint wheels, each with separate lightness from −100 to +100%. |
+| Vignette | Amount −100 to +100% (positive darkens, negative lightens), midpoint 0–100%, roundness −100 to +100%, and feather 0–100%. |
| 3D LUT | Import or replace a `.cube` file and blend it at 0–100% intensity. |
-The render order is Chroma Key → Gaussian Blur → Sharpen → Color Correction → LUT → Vignette → Look temperature. Transform, opacity, and transitions composite the result into the timeline. This order is fixed; the inspector is not a reorderable effect stack. Blur radii refer to source resolution, so preview and export use the same radius even at different output sizes.
+The render order is Chroma Key → Gaussian Blur → Sharpen (standalone + Creative) → Basic Corrections → Creative look / faded film / vibrance → Curves → Color Wheels → LUT → Vignette → Look temperature. Transform, opacity, and transitions composite the result into the timeline. This order is fixed; the inspector is not a reorderable effect stack. Blur radii refer to source resolution, so preview and export use the same radius even at different output sizes.
+
+Creative includes **Teal & Orange**, **Warm Film**, **Cool Blue**, **Bleach Bypass**, **Faded Matte**, **Monochrome**, **Golden Hour**, and **Night**. These are shader colour transforms, not LUT files. None and zero look intensity leave the look unchanged; faded film, sharpening and vibrance remain independently adjustable. Vibrance gives less saturated colours more weight.
+
+Choose a curve from the channel menu. Click the graph or use Add point to insert a control point, drag a point, or enter its input/output coordinates. Arrow keys move a focused point (Shift makes larger steps), and Delete removes an interior point. Reset curve resets the selected channel; the effect header resets all channels. Shape-preserving monotone cubic interpolation passes through the points without segment overshoot. Hue curves link their endpoints and use matching tangents across the red seam. Their neutral line is 50%: hue vs hue offsets hue, hue vs luma offsets HSL lightness, and the saturation curves multiply saturation. Luma vs saturation uses HSL lightness, matching FilmCraft's grading convention. Small sampled curve buffers are rebuilt only when settings change; no picture pixels are read back from the GPU.
+
+Drag each wheel toward a colour to tint that tonal range. Arrow keys adjust the tint, Home or a double-click recentres it, and its reset button also resets lightness. Shadow and highlight weights taper smoothly into midtones. The lightness sliders work independently of tint.
+
+Vignette midpoint moves the start of the edge treatment, feather changes its transition width, and roundness moves from a rounded rectangle through a frame-shaped ellipse to a circle. Existing vignette amounts retain their appearance with midpoint 50%, roundness 0%, and feather 100%.
+
+All new effects support bypass, reset, copy/paste, removal, project save/reopen, and the existing undo workflow. Older correction settings keep the `colorCorrection` project key and render with neutral defaults for the new controls.
LUT import accepts 3D `.cube` tables from 2³ through 65³, including `TITLE`, `DOMAIN_MIN`/`DOMAIN_MAX`, and Resolve's `LUT_3D_INPUT_RANGE`. Tables use red-fastest row order and trilinear interpolation. One-dimensional and combined shaper LUTs are rejected with an explanation. Files are limited to 16 MB. LUTs are embedded in the project and need no external file after import. A failed replacement leaves the previous LUT intact.
@@ -22,3 +35,5 @@ These effects require WebGPU. Preview and export share the same shader processor
If a GPU is unavailable, the monitor reports an error and export refuses to produce a file with these effects omitted. Projects without these effects retain the existing canvas export fallback.
Implementation references: [WebGPU external textures](https://www.w3.org/TR/webgpu/#external-texture), [WGSL](https://www.w3.org/TR/WGSL/), and the [Adobe Cube specification](https://kono.phpage.fr/images/a/a1/Adobe-cube-lut-specification-1.0.pdf).
+
+The Creative transforms are adapted from [FilmCraft's procedural looks](https://github.com/storytold/filmcraft/blob/main/crates/render/src/effects.rs), used under the [MIT license](../public/licenses/filmcraft.txt).
diff --git a/src-tauri/src/tests/persistence.rs b/src-tauri/src/tests/persistence.rs
index b8e4d90..b931ae2 100644
--- a/src-tauri/src/tests/persistence.rs
+++ b/src-tauri/src/tests/persistence.rs
@@ -448,3 +448,40 @@ fn blank_brief_is_a_valid_empty_project() {
config.generation_jobs.clear();
assert!(validate_and_normalize_config(config).is_ok());
}
+
+#[test]
+fn color_grading_round_trips_and_validates() {
+ let mut json = serde_json::to_value(fixture()).unwrap();
+ let clip = &mut json["timeline"]["tracks"][0]["clips"][0];
+ clip["colorCorrection"] = serde_json::json!({"exposure":1.0,"contrast":20.0,"saturation":80.0,"temperature":25.0,"tint":-15.0,"highlights":-20.0,"shadows":30.0,"whites":10.0,"blacks":-10.0});
+ clip["creative"] = serde_json::json!({"look":"Warm Film","intensity":65.0,"fadedFilm":10.0,"sharpen":35.0,"vibrance":-15.0,"enabled":false});
+ clip["curves"] = serde_json::json!({"rgb":[[0.0,0.0],[0.5,0.7],[1.0,1.0]],"red":[[0.0,0.1],[1.0,0.9]],"green":[[0.0,0.0],[1.0,1.0]],"blue":[[0.0,0.0],[1.0,1.0]],"hueVsSat":[[0.0,0.5],[0.2,0.8],[1.0,0.5]],"hueVsHue":[[0.0,0.5],[1.0,0.5]],"hueVsLuma":[[0.0,0.5],[1.0,0.5]],"lumaVsSat":[[0.0,0.2],[1.0,0.8]],"satVsSat":[[0.0,0.5],[1.0,0.5]]});
+ clip["colorWheels"] = serde_json::json!({"shadows":{"x":0.3,"y":-0.4,"lightness":10.0},"midtones":{"x":0.0,"y":0.0,"lightness":-20.0},"highlights":{"x":0.2,"y":0.1,"lightness":30.0}});
+ clip["vignette"] = serde_json::json!({"amount":-30.0,"midpoint":20.0,"roundness":-15.0,"feather":65.0});
+ let config = without_derived_project_state(validate_and_normalize_config(serde_json::from_value(json.clone()).unwrap()).unwrap());
+ // Compare serialized effects too: equality of two Rust structs alone would miss dropped fields.
+ let serialized = serde_json::to_value(&config).unwrap();
+ for effect in ["colorCorrection", "creative", "curves", "colorWheels", "vignette"] {
+ assert_eq!(serialized["timeline"]["tracks"][0]["clips"][0][effect], json["timeline"]["tracks"][0]["clips"][0][effect]);
+ }
+ let root = tempfile::tempdir().unwrap();
+ let created = create_project_in(root.path(), &config).unwrap();
+ let folder = PathBuf::from(&created.folder_path);
+ write_project(&folder, &config).unwrap();
+ assert_eq!(read_project(&folder).unwrap().config, config);
+ for (effect, field, value) in [
+ ("colorCorrection", "temperature", serde_json::json!(101)),
+ ("colorCorrection", "shadows", serde_json::json!(-101)),
+ ("creative", "look", serde_json::json!("unknown")),
+ ("creative", "vibrance", serde_json::json!(101)),
+ ("vignette", "feather", serde_json::json!(-1)),
+ ("curves", "rgb", serde_json::json!([])),
+ ("curves", "rgb", serde_json::json!([[0,0],[0,1]])),
+ ("curves", "hueVsHue", serde_json::json!([[0,0.1],[1,0.9]])),
+ ("colorWheels", "shadows", serde_json::json!({"x":1,"y":1,"lightness":0})),
+ ] {
+ let mut invalid = json.clone();
+ invalid["timeline"]["tracks"][0]["clips"][0][effect][field] = value;
+ assert!(validate_and_normalize_config(serde_json::from_value(invalid).unwrap()).is_err(), "{effect}.{field}");
+ }
+}
diff --git a/src/components/workspace/CurveEditor.tsx b/src/components/workspace/CurveEditor.tsx
index 52161ea..5a9d9bd 100644
--- a/src/components/workspace/CurveEditor.tsx
+++ b/src/components/workspace/CurveEditor.tsx
@@ -21,7 +21,9 @@ export function CurveEditor({ value, disabled, onChange }: { value: NonNullable<
const move = (i: number, x: number, y: number) => {
const next = latest.current.map((p) => [...p] as CurvePoint);
const last = next.length - 1;
- next[i] = [i === 0 ? 0 : i === last ? 1 : clamp(x, next[i - 1][0] + .002, next[i + 1][0] - .002), clamp(y)];
+ const lo = i > 0 ? next[i - 1][0] + .001001 : 0;
+ const hi = i < last ? next[i + 1][0] - .001001 : 1;
+ next[i] = [i === 0 ? 0 : i === last ? 1 : lo > hi ? next[i][0] : clamp(x, lo, hi), clamp(y)];
if (periodic && (i === 0 || i === last)) next[i === 0 ? last : 0][1] = next[i][1];
commit(next);
};
@@ -39,6 +41,7 @@ export function CurveEditor({ value, disabled, onChange }: { value: NonNullable<
<ComboBox aria-label="Curve channel" value={channel} disabled={disabled} options={CURVE_CHANNELS.map((c) => ({ value: c, label: LABELS[c] }))}
onChange={(c) => { setChannel(c); setSelected(0); drag.current = null; }} />
<svg ref={svg} className={`grading-curves__graph grading-curves__graph--${channel}`} viewBox="0 0 256 256" aria-label={`${LABELS[channel]} curve`} aria-describedby={hint}
+ style={{ color: ({ red: "#ed7373", green: "#73c88f", blue: "#81aaff" } as Partial<Record<CurveChannel, string>>)[channel] }}
onPointerDown={(e) => {
if (disabled || e.button !== 0) return;
const [x, y] = position(e);
@@ -63,9 +66,9 @@ export function CurveEditor({ value, disabled, onChange }: { value: NonNullable<
}} />)}
</svg>
<div className="grading-curves__coordinates">
- <label>Input <input aria-label="Curve point input" type="number" min={0} max={100} step={1} value={+(points[index][0] * 100).toFixed(1)} disabled={disabled || index === 0 || index === points.length - 1}
+ <label>Input <input className="text-field" aria-label="Curve point input" type="number" min={0} max={100} step={1} value={+(points[index][0] * 100).toFixed(1)} disabled={disabled || index === 0 || index === points.length - 1}
onChange={(e) => { if (Number.isFinite(e.target.valueAsNumber)) move(index, e.target.valueAsNumber / 100, points[index][1]); }} /></label>
- <label>Output <input aria-label="Curve point output" type="number" min={0} max={100} step={1} value={+(points[index][1] * 100).toFixed(1)} disabled={disabled}
+ <label>Output <input className="text-field" aria-label="Curve point output" type="number" min={0} max={100} step={1} value={+(points[index][1] * 100).toFixed(1)} disabled={disabled}
onChange={(e) => { if (Number.isFinite(e.target.valueAsNumber)) move(index, points[index][0], e.target.valueAsNumber / 100); }} /></label>
</div>
<div className="grading-curves__actions">
diff --git a/src/components/workspace/GradingWheel.tsx b/src/components/workspace/GradingWheel.tsx
index 4e50351..84894cc 100644
--- a/src/components/workspace/GradingWheel.tsx
+++ b/src/components/workspace/GradingWheel.tsx
@@ -11,7 +11,8 @@ export function GradingWheel({ label, x, y, disabled, onChange }: { label: strin
const bounds = event.currentTarget.getBoundingClientRect();
set((event.clientX - bounds.left) / bounds.width * 2 - 1, 1 - (event.clientY - bounds.top) / bounds.height * 2);
};
- return <div className="grading-wheel" role="slider" tabIndex={disabled ? -1 : 0} aria-disabled={disabled} aria-label={`${label} color`} aria-valuemin={0} aria-valuemax={100} aria-valuenow={Math.round(Math.hypot(x, y) * 100)}
+ // These are signal colours, independent of the application's light/dark palette.
+ return <div style={{ background: "radial-gradient(circle, #999, transparent 70%), conic-gradient(from 90deg, #ff8080, #ff80ff, #8080ff, #80ffff, #80ff80, #ffff80, #ff8080)" }} className="grading-wheel" role="slider" tabIndex={disabled ? -1 : 0} aria-disabled={disabled} aria-label={`${label} color`} aria-valuemin={0} aria-valuemax={100} aria-valuenow={Math.round(Math.hypot(x, y) * 100)}
aria-valuetext={`Horizontal ${Math.round(x * 100)}, vertical ${Math.round(y * 100)}`} title="Drag to tint. Arrow keys adjust; Home resets color."
onPointerDown={(event) => { if (disabled || event.button !== 0) return; dragging.current = true; event.currentTarget.setPointerCapture(event.pointerId); event.currentTarget.focus(); point(event); }}
onPointerMove={(event) => { if (dragging.current) point(event); }} onPointerUp={() => { dragging.current = false; }} onPointerCancel={() => { dragging.current = false; }} onLostPointerCapture={() => { dragging.current = false; }}
diff --git a/src/lib/colorCurves.test.ts b/src/lib/colorCurves.test.ts
index c2fb197..7a76134 100644
--- a/src/lib/colorCurves.test.ts
+++ b/src/lib/colorCurves.test.ts
@@ -37,8 +37,9 @@ describe("shape-preserving curves", () => {
expect(compiled.values[2 * CURVE_SAMPLES - 1]).toBeCloseTo(.9);
expect(compiled.values[4 * CURVE_SAMPLES + 500]).toBeCloseTo(.3);
});
- it.each([[], [[0, 0]], [[0, 0], [0, 1]], [[0, 0], [.5, 1], [.4, 0], [1, 1]], [[0, 0], [1, NaN]], [[.1, 0], [1, 1]], [[0, 0], [1, 1.1]]])("rejects malformed curve data", (points) => {
+ it.each([[], [[0, 0]], [[0, 0], [0, 1]], [[0, 0], [.5, 1], [.4, 0], [1, 1]], [[0, 0], [1, NaN]], [[.1, 0], [1, 1]], [[0, 0], [1, 1.1]]].map((points) => ({ points })))("rejects malformed curve data", ({ points }) => {
expect(curveSchema.safeParse(points).success).toBe(false);
+ expect(effectSchemas.curves.safeParse({ hueVsSat: points }).success).toBe(false);
});
});
diff --git a/src/lib/effectSettings.ts b/src/lib/effectSettings.ts
index 1db2659..5758f1c 100644
--- a/src/lib/effectSettings.ts
+++ b/src/lib/effectSettings.ts
@@ -28,11 +28,11 @@ const percent = z.number().finite().min(0).max(100);
const signedPercent = z.number().finite().min(-100).max(100);
const unit = z.number().finite().min(0).max(1);
export const curveSchema = z.array(z.tuple([unit, unit])).min(2).max(32).superRefine((points, context) => {
- if (points[0][0] !== 0 || points[points.length - 1][0] !== 1 || points.some((p, i) => i > 0 && p[0] - points[i - 1][0] < 0.001)) {
+ if (points.length < 2 || points[0][0] !== 0 || points[points.length - 1][0] !== 1 || points.some((p, i) => i > 0 && p[0] - points[i - 1][0] < 0.001)) {
context.addIssue({ code: "custom", message: "Curves need endpoints at 0 and 1 and increasing inputs at least 0.001 apart." });
}
});
-const hueCurveSchema = curveSchema.refine((p) => p[0][1] === p[p.length - 1][1], "Hue curve endpoints must match.");
+const hueCurveSchema = curveSchema.refine((p) => p.length >= 2 && p[0][1] === p[p.length - 1][1], "Hue curve endpoints must match.");
export const CREATIVE_LOOKS = ["None", "Teal & Orange", "Warm Film", "Cool Blue", "Bleach Bypass", "Faded Matte", "Monochrome", "Golden Hour", "Night"] as const;
export const CURVE_CHANNELS = ["rgb", "red", "green", "blue", "hueVsSat", "hueVsHue", "hueVsLuma", "lumaVsSat", "satVsSat"] as const;
export type CurveChannel = typeof CURVE_CHANNELS[number];
diff --git a/src/styles/timeline.css b/src/styles/timeline.css
index 7aa5926..d56bb89 100644
--- a/src/styles/timeline.css
+++ b/src/styles/timeline.css
@@ -1731,24 +1731,22 @@ button.transport-time:hover { background: var(--fill-subtle-hover); }
.program-picture > video, .program-picture > img, .program-keyed-picture { position: absolute; inset: 0; }
/* Grading controls share the inspector's compact sizing. */
-.grading-curves { display: grid; gap: 10px; min-width: 0; }
-.grading-curves__graph { width: calc(100% - 12px); margin: 6px; aspect-ratio: 1; overflow: visible; touch-action: none; background: var(--fill-subtle-hover); border: 1px solid var(--stroke-default); color: var(--text-primary); }
+.grading-curves { display: grid; gap: var(--space-2); min-width: 0; color: var(--text-primary); }
+.grading-curves__graph { width: calc(100% - 16px); margin: var(--space-2); aspect-ratio: 1; overflow: visible; touch-action: none; background: var(--fill-subtle-hover); border: 1px solid var(--stroke-control); color: var(--text-primary); }
.grading-curves__grid { stroke: currentColor; opacity: .12; fill: none; }
.grading-curves__baseline { stroke: currentColor; opacity: .3; stroke-dasharray: 4 4; fill: none; }
.grading-curves__line { stroke: currentColor; stroke-width: 2; fill: none; }
-.grading-curves__graph--red { color: #ed7373; }
-.grading-curves__graph--green { color: #73c88f; }
-.grading-curves__graph--blue { color: #81aaff; }
-.grading-curves__point { fill: currentColor; stroke: #222; stroke-width: 1; cursor: grab; }
-.grading-curves__point--selected, .grading-curves__point:focus { stroke: #fff; stroke-width: 2; outline: none; }
-.grading-curves__coordinates, .grading-curves__actions { display: flex; gap: 6px; flex-wrap: wrap; }
-.grading-curves__coordinates label { display: flex; align-items: center; gap: 6px; flex: 1; font-size: 11px; }
-.grading-curves__coordinates input { width: 60px; min-width: 0; }
-.grading-curves__actions .secondary-button { padding: 4px 8px; min-height: 26px; font-size: 11px; }
-.grading-wheel-section { display: grid; gap: 8px; }
-.grading-wheel-section__heading { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
-.grading-wheel { position: relative; width: 128px; height: 128px; margin: 6px auto; border-radius: 50%; touch-action: none; cursor: crosshair; background: radial-gradient(circle, #999, transparent 70%), conic-gradient(from 90deg, #ff8080, #ff80ff, #8080ff, #80ffff, #80ff80, #ffff80, #ff8080); box-shadow: inset 0 0 0 1px #ffffff40; }
-.grading-wheel:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 3px; }
+.grading-curves__point { fill: currentColor; stroke: var(--panel); stroke-width: 1; cursor: grab; }
+.grading-curves__point--selected, .grading-curves__point:focus { stroke: var(--focus-outer); stroke-width: 2; outline: none; }
+.grading-curves__coordinates, .grading-curves__actions { display: flex; gap: var(--space-1); flex-wrap: wrap; }
+.grading-curves__coordinates label { display: flex; align-items: center; gap: var(--space-1); flex: 1; font-size: var(--text-xs); }
+.grading-curves__coordinates .text-field { width: 64px; min-width: 0; height: var(--control-sm); padding: 0 var(--space-1); font-size: var(--text-xs); }
+.grading-curves__actions .secondary-button { padding: var(--space-1) var(--space-2); min-height: var(--control-sm); font-size: var(--text-xs); }
+.grading-curves .clip-effect__note { padding-left: 0; }
+.grading-wheel-section { display: grid; gap: var(--space-2); color: var(--text-primary); }
+.grading-wheel-section__heading { display: flex; align-items: center; justify-content: space-between; font-size: var(--text-xs); }
+.grading-wheel { position: relative; width: 128px; height: 128px; margin: var(--space-2) auto; border-radius: 50%; touch-action: none; cursor: crosshair; box-shadow: inset 0 0 0 1px var(--stroke-control); }
+.grading-wheel:focus-visible { outline: 2px solid var(--focus-outer); outline-offset: 3px; }
.grading-wheel[aria-disabled="true"] { opacity: .4; cursor: default; }
-.grading-wheel__center { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; border-radius: 50%; background: #555; transform: translate(-50%, -50%); }
-.grading-wheel__handle { position: absolute; width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #222; transform: translate(-50%, -50%); pointer-events: none; }
+.grading-wheel__center { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; border-radius: 50%; background: var(--text-secondary); transform: translate(-50%, -50%); }
+.grading-wheel__handle { position: absolute; width: 10px; height: 10px; border: 2px solid var(--focus-outer); border-radius: 50%; box-shadow: 0 0 0 1px var(--focus-inner); transform: translate(-50%, -50%); pointer-events: none; }