M9.12: effect parameter fidelity – all categories

Align every effect's display name, category, parameter names, order,
twirl-down groups, popup options, units, defaults and ranges with the
public After Effects effect reference, and implement controls that were
ignored or missing where cheap. One commit because the categories share
the registry, migration tables and GPU kernels (only green states).

Infrastructure
- effects::migrate: saved instances are upgraded on project open
  (Session::replace_project → upgrade_effects): renamed ids
  (PARAM_ID_ALIASES), params moved into twirl-down groups, popup values
  remapped by label (POPUP_LABEL_ALIASES), refreshed names/UI hints,
  added params created with legacy_default values that keep old renders.
- flatten_params also keys nested props by match path (group/param), so
  effects declare grouped params with `group/param` ids; layer-source
  companions sit next to grouped layer params.
- lookup() resolves old effect names (EFFECT_NAME_ALIASES).
- Registry-wide test: unique ids/names, non-empty names, defaults in
  range, popup defaults within options, value kinds match UI.
- docs/effects.md generated from the registry (catalog.rs) with GPU /
  32-bpc badges and per-effect status; a test keeps it current.

Batches
- Blur & Sharpen, Channel, 3D Channel, Perspective, Text, Utility:
  Camera Lens Blur iris/highlight groups, Compound Blur layer, Camera-
  Shake Deblur method/strength, Invert full channel list (CPU HLS/YIQ),
  Set Channels/Set Matte layers, Channel Combiner targets, 3D Channel
  Extract clamp/invert.
- Color Correction: temporal smoothing + scene detect for Auto Color/
  Contrast/Levels and Shadow/Highlight, Brightness & Contrast legacy
  switch, Change to Color tolerance group, Leave Color, Photo Filter
  presets, Exposure channels, Levels clip popups, Colorama phase source,
  Color Link sample list, Lumetri groups (CPU + GPU kernels).
- Distort: Bulge, Displacement Map layer/behaviour, Magnify, Optics
  Compensation resize, Ripple conversion, Transform sampling, Turbulent
  Displace types/pinning/evolution, Wave Warp types/pinning, Twirl and
  Ripple radius fixes.
- Generate: 4-Color Gradient, Checkerboard, Grid, Circle size/feather/
  blending, Advanced Lightning types, Cell Pattern, Radio Waves, Fractal
  palettes, Scribble/Vegas names.
- Keying, Matte, Obsolete: Color Difference Key partials/views, Unmult
  controls, Key Light groups, Refine Soft/Hard Matte, Roto Brush groups,
  Mocha shape moved to Matte, Spill Suppressor accuracy, Basic/Path Text
  groups.
- Noise & Grain, Immersive Video, Audio, Time: Fractal/Turbulent Noise
  full control set (noise3.rs, GPU), grain look groups, Remove Grain,
  VR effects, Compressor/Gate/Distortion controls, Timewarp groups,
  VR Sphere to Plane name.
- Simulation: AE twirl-down groups for all simulations, Foam strength,
  Particle Playground barrel radius and mapper targets.
- Stylize, Transition: Glow looping/dimensions/alpha (CPU + GPU),
  Mosaic averaging, Cartoon groups, Roughen Edges evolution, Texturize
  layer, Gradient Wipe layer, Radial Wipe both, Card Wipe options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-03 00:15:06 -04:00
co-authored by Claude Opus 5.5
parent 0631ef29dc
commit 355a6255a2
51 changed files with 6799 additions and 1737 deletions
+69 -7
View File
@@ -212,17 +212,42 @@ fn inner_outer_key(ctx: &EffectCtx, mut b: Buf) -> Buf {
// ---------------------------------------------------------------- Unmult
/// Turns black into transparency: alpha becomes the brightest straight channel and colour is
/// divided by it (premultiplied colour is unchanged).
fn unmult(_: &EffectCtx, mut b: Buf) -> Buf {
/// Turns a black (or white) background into transparency. Alpha ramps up from the level (Black
/// Level: on the brightest channel; White Level: on the darkest channel, mirrored) over a
/// transition whose width is Softness (0 % = hard cutoff at the level, 100 % = the whole
/// remaining range, which with the default levels is the classic unmultiply: alpha = brightest
/// channel). Remove Color Matting takes the background colour back out of semi-transparent
/// pixels; Clip HDR Results keeps the recovered colours in 0..1.
fn unmult(ctx: &EffectCtx, mut b: Buf) -> Buf {
let pr = ctx.params;
let white = pr.e("backgroundColor") == 1;
let level = if white { pr.f("whiteLevel") } else { pr.f("blackLevel") }.clamp(0.0, 100.0) as f32 / 100.0;
let soft = pr.f("softness").clamp(0.0, 100.0) as f32 / 100.0;
let decon = pr.b("removeColorMatting");
let clip = pr.b("clipHdrResults");
b.img.data.par_iter_mut().for_each(|px| {
let (c, a) = unpremul(*px);
let m = c[0].max(c[1]).max(c[2]).clamp(0.0, 1.0);
let (c, a0) = unpremul(*px);
// Distance from the background colour, and where the ramp starts on that scale.
let (d, start) = if white { (1.0 - c[0].min(c[1]).min(c[2]), 1.0 - level) } else { (c[0].max(c[1]).max(c[2]), level) };
let d = d.clamp(0.0, 1.0);
let width = soft * (1.0 - start);
let m = if width > 1e-6 {
((d - start) / width).clamp(0.0, 1.0)
} else if d > start {
1.0
} else {
0.0
};
if m <= 1e-6 {
*px = [0.0; 4];
return;
}
*px = premul([c[0] / m, c[1] / m, c[2] / m], a * m);
let bg = if white { 1.0 } else { 0.0 };
let mut out = if decon { c.map(|v| (v - bg * (1.0 - m)) / m) } else { c };
if clip {
out = out.map(|v| v.clamp(0.0, 1.0));
}
*px = premul(out, a0 * m);
});
b
}
@@ -321,7 +346,19 @@ pub fn specs() -> Vec<EffectSpec> {
],
inner_outer_key,
),
spec("ec.key.unmult", "Unmult", vec![], unmult),
spec(
"ec.key.unmult",
"Unmult",
vec![
p("backgroundColor", "Background Color", Value::Enum(0), popup(&["Black", "White"])),
p("blackLevel", "Black Level", num(0.0), pct()),
p("whiteLevel", "White Level", num(100.0), pct()),
p("softness", "Softness", num(100.0), pct()),
p("removeColorMatting", "Remove Color Matting", Value::Bool(true), ParamUi::Checkbox),
p("clipHdrResults", "Clip HDR Results", Value::Bool(true), ParamUi::Checkbox),
],
unmult,
),
spec(
"ec.key.ccsimplewireremoval",
"CC Simple Wire Removal",
@@ -398,6 +435,31 @@ mod tests {
assert!((p[3] - 0.5).abs() < 1e-6 && (p[0] - 0.5).abs() < 1e-6);
}
#[test]
fn unmult_white_background_levels_and_softness() {
// White background: white goes transparent, a half-grey pixel half transparent with its
// colour recovered as black.
let mut img = Image::filled(3, 1, [1.0, 1.0, 1.0, 1.0]);
img.set(1, 0, [0.5, 0.5, 0.5, 1.0]);
img.set(2, 0, [0.0, 0.0, 0.0, 1.0]);
let out = run_fx("ec.key.unmult", &[("backgroundColor", Value::Enum(1))], img.clone(), 0.0, EffectEnv::default());
assert_eq!(out.img.get(0, 0), [0.0; 4]);
let p = out.img.get(1, 0);
assert!((p[3] - 0.5).abs() < 1e-5 && p[0].abs() < 1e-5, "{p:?}");
assert_eq!(out.img.get(2, 0), [0.0, 0.0, 0.0, 1.0]);
// Hard cutoff: Softness 0 with Black Level 40 % keeps a 50 % grey fully opaque, and
// without Remove Color Matting the colour is untouched.
let hard = run_fx(
"ec.key.unmult",
&[("blackLevel", num(40.0)), ("softness", num(0.0)), ("removeColorMatting", Value::Bool(false))],
img,
0.0,
EffectEnv::default(),
);
assert_eq!(hard.img.get(1, 0), [0.5, 0.5, 0.5, 1.0]);
assert_eq!(hard.img.get(2, 0), [0.0; 4]);
}
#[test]
fn wire_removal_hides_a_wire() {
let mut img = Image::filled(20, 20, [0.5, 0.5, 0.5, 1.0]);