diff --git a/crates/aep/src/export/fx_defs.rs b/crates/aep/src/export/fx_defs.rs index fb83eed8a..75c430064 100644 --- a/crates/aep/src/export/fx_defs.rs +++ b/crates/aep/src/export/fx_defs.rs @@ -736,10 +736,6 @@ mod tests { ("ec.time.pixelmotionblur", "shutterSamples", 3482), ("ec.noise.fractal", "subSettings/subInfluence", 3485), ("ec.noise.fractal", "subSettings/subScaling", 3486), - ("ec.distort.ccpowerpin", "expandTop", 3492), - ("ec.distort.ccpowerpin", "expandLeft", 3492), - ("ec.distort.ccpowerpin", "expandRight", 3492), - ("ec.distort.ccpowerpin", "expandBottom", 3492), ]; /// `a` is at most `b`, allowing for the `f32` the recorded bounds were read from. diff --git a/crates/effects/src/distort3.rs b/crates/effects/src/distort3.rs index 34fc282ed..ed88e2d84 100644 --- a/crates/effects/src/distort3.rs +++ b/crates/effects/src/distort3.rs @@ -955,10 +955,12 @@ pub fn specs() -> Vec { p("bottomRight", "Bottom Right", pt(1.0, 1.0), ParamUi::Point), p("perspective", "Perspective", num(100.0), pct()), p("unstretch", "Unstretch", Value::Bool(false), ParamUi::Checkbox), - p("expandTop", "Top", num(0.0), slider(-100.0, 1000.0, 0.0, 100.0, 1)), - p("expandLeft", "Left", num(0.0), slider(-100.0, 1000.0, 0.0, 100.0, 1)), - p("expandRight", "Right", num(0.0), slider(-100.0, 1000.0, 0.0, 100.0, 1)), - p("expandBottom", "Bottom", num(0.0), slider(-100.0, 1000.0, 0.0, 100.0, 1)), + // Expansion: percent of the layer size each source edge moves out (After Effects' + // valid range is -200..200; the maximum stays at 1000 so existing values are kept). + p("expandTop", "Top", num(0.0), slider(-200.0, 1000.0, 0.0, 100.0, 1)), + p("expandLeft", "Left", num(0.0), slider(-200.0, 1000.0, 0.0, 100.0, 1)), + p("expandRight", "Right", num(0.0), slider(-200.0, 1000.0, 0.0, 100.0, 1)), + p("expandBottom", "Bottom", num(0.0), slider(-200.0, 1000.0, 0.0, 100.0, 1)), ], cc_power_pin, ), diff --git a/crates/effects/src/distort3/tests.rs b/crates/effects/src/distort3/tests.rs index b50d6b450..8ccc80ad4 100644 --- a/crates/effects/src/distort3/tests.rs +++ b/crates/effects/src/distort3/tests.rs @@ -250,6 +250,57 @@ fn power_pin_unstretch_expands_pinned_region() { assert!(maxd(&id.img, &im) < 1e-4); } +/// #3492: an Expansion side moves that edge of the source rectangle by a percent of the layer +/// size. When two opposite sides add up to less than -100 % the edges cross and the rectangle +/// flips: Top -200 and Bottom -100 take rows 40 down to 0 of a 20-row layer, a mirrored copy +/// squeezed into the bottom half (the top half samples below the layer and is transparent). +/// -100 for both (the most the old minimum allowed) mirrors the whole layer. +#[test] +fn power_pin_crossed_expansion_flips_the_source() { + let im = img(20, 20); + let o = run("ec.distort.ccpowerpin", &[("expandTop", num(-200.0)), ("expandBottom", num(-100.0))], im.clone(), &[]); + assert_eq!((o.img.width, o.img.height), (20, 20)); + // Output row 15: v = 15.5 / 20, source y = 40 - 40 v = 9 (between rows 8 and 9). + let px = o.img.get(10, 15); + assert!((px[1] - 8.5 / 20.0).abs() < 1e-3, "{px:?}"); + assert_eq!(o.img.get(10, 5)[3], 0.0); + let both = run("ec.distort.ccpowerpin", &[("expandTop", num(-100.0)), ("expandBottom", num(-100.0))], im.clone(), &[]); + // Source y = 20 - 20 v = 4.5, row 4's centre. + let px = both.img.get(10, 15); + assert!((px[1] - 4.0 / 20.0).abs() < 1e-3, "{px:?}"); +} + +/// #3492: the buffer is sized by the pins alone, and Expansions at the ends of -200..1000 render +/// finite images: all sides at either end, flipped sources, a zero-size source (Top -50, Bottom +/// -50), and Unstretch, which divides by the source size (a zero size renders transparent). +#[test] +fn power_pin_is_finite_at_the_expansion_extremes() { + let im = img(24, 16); + let pins = [("topLeft", pt(3.0, -4.0)), ("topRight", pt(26.0, 2.0)), ("bottomRight", pt(20.0, 18.0)), ("bottomLeft", pt(-2.0, 14.0))]; + let sides = ["expandTop", "expandLeft", "expandRight", "expandBottom"]; + let cases: &[[f64; 4]] = + &[[-200.0; 4], [1000.0; 4], [-50.0, 0.0, 0.0, -50.0], [0.0, -200.0, -200.0, 0.0], [-200.0, 1000.0, -200.0, 1000.0], [-100.0, -150.0, 50.0, -200.0]]; + for unstretch in [false, true] { + for perspective in [100.0, 40.0] { + let mut base: Vec<(&str, Value)> = pins.to_vec(); + base.push(("unstretch", Value::Bool(unstretch))); + base.push(("perspective", num(perspective))); + let size = |o: &Buf| (o.img.width, o.img.height); + let neutral = size(&run("ec.distort.ccpowerpin", &base, im.clone(), &[])); + for ex in cases { + let mut set = base.clone(); + set.extend(sides.iter().zip(ex).map(|(s, v)| (*s, num(*v)))); + let o = run("ec.distort.ccpowerpin", &set, im.clone(), &[]); + let at = format!("{ex:?} unstretch {unstretch} perspective {perspective}"); + assert_eq!(size(&o), neutral, "{at}"); + for p in &o.img.data { + assert!(p.iter().all(|c| c.is_finite()) && (0.0..=1.0).contains(&p[3]), "{at}: {p:?}"); + } + } + } + } +} + #[test] fn split_opens_a_gap() { let im = img(40, 30); diff --git a/crates/engine/src/tests/effect_ranges.rs b/crates/engine/src/tests/effect_ranges.rs index 6cc457888..16ac9f6e5 100644 --- a/crates/engine/src/tests/effect_ranges.rs +++ b/crates/engine/src/tests/effect_ranges.rs @@ -61,6 +61,10 @@ const ROWS: &[(u32, &str, &str, f64, f64)] = &[ (3471, "ec.distort.transform", "scaleWidth", -30000.0, 30000.0), (3470, "ec.distort.turbulentdisplace", "evolutionOptions/randomSeed", 0.0, 100000.0), (3467, "ec.blur.radial", "amount", 0.0, 1000.0), + (3492, "ec.distort.ccpowerpin", "expandTop", -200.0, 1000.0), + (3492, "ec.distort.ccpowerpin", "expandLeft", -200.0, 1000.0), + (3492, "ec.distort.ccpowerpin", "expandRight", -200.0, 1000.0), + (3492, "ec.distort.ccpowerpin", "expandBottom", -200.0, 1000.0), ]; fn path(effect: &str, param: &str) -> String { diff --git a/crates/gpu/src/tests/fx_stylize.rs b/crates/gpu/src/tests/fx_stylize.rs index 8c6c7be33..108dfca53 100644 --- a/crates/gpu/src/tests/fx_stylize.rs +++ b/crates/gpu/src/tests/fx_stylize.rs @@ -218,6 +218,13 @@ fn twirl_legacy_ripple_pulse_power_pin() { // Perspective below 100 %: blended toward the bilinear inverse. effect_case("ec.distort.ccpowerpin", &[("topRight", pt(80.0, -6.0)), ("bottomLeft", pt(-4.0, 50.0)), ("perspective", n(0.0))]); effect_case("ec.distort.ccpowerpin", &[("topLeft", pt(12.0, 6.0)), ("bottomRight", pt(75.0, 30.0)), ("perspective", n(40.0)), ("expandTop", n(15.0))]); + // #3492: Expansion down to -200; opposite sides adding up to less than -100 % flip the source, + // and Top -50 / Bottom -50 leave it zero high. + effect_case("ec.distort.ccpowerpin", &[("topRight", pt(80.0, -6.0)), ("expandTop", n(-200.0)), ("expandBottom", n(-100.0)), ("expandLeft", n(-150.0))]); + effect_case( + "ec.distort.ccpowerpin", + &[("bottomLeft", pt(-4.0, 50.0)), ("perspective", n(40.0)), ("expandTop", n(-50.0)), ("expandBottom", n(-50.0)), ("expandRight", n(-200.0))], + ); } #[test] diff --git a/docs/effects-parity.md b/docs/effects-parity.md index 1ef31c413..30d80d24c 100644 --- a/docs/effects-parity.md +++ b/docs/effects-parity.md @@ -65,6 +65,7 @@ the GPU is performance, not parity. | Date | Change | Summary | |---|---|---| | 2026-11-17 | minor | Radial Blur: Amount takes After Effects' valid range 0..1000 (slider and default unchanged); Zoom past 200 spreads its samples from the centre outwards instead of sampling the layer mirrored through the centre (CPU and GPU; not yet measured against After Effects past Amount 200) | +| 2026-11-17 | minor | CC Power Pin: Expansion (Top, Left, Right, Bottom) takes After Effects' minimum of −200 % (hard range −200..1000; defaults and sliders unchanged). When two opposite sides add up to less than −100 % the source rectangle flips (CPU and GPU) | | 2026-11-12 | minor | Parameters take After Effects' recorded valid ranges (hard range; defaults and sliders unchanged): Levels (Individual Controls) levels −10000..10000 and Gamma from 0; 4-Color Gradient Blend to 10000 and Jitter to 500 %; Change Color Hue Transform ±1800°; Noise HLS (and Auto) amounts to 1000 % and Grain Size from 0; Grid Border to 2000; Venetian Blinds Width 1..32000 and Feather to 32000; Radial Wipe Feather to 32000; Scatter Amount to 1000; Beam thicknesses to 4000; Transform Scale ±30000 %; Turbulent Displace Random Seed to 100000. A test checks every mapped parameter's range against the recorded table (CPU and GPU) | | 2026-10-19 | minor | Glow (original colours): bright pass per channel, 8 × (value − threshold + 0.061), measured against After Effects 2026 (CPU and GPU) | | 2026-10-19 | minor | Glow (colour channels): the glow covers the layer's blurred alpha, blur σ = 0.384 × radius, measured against After Effects 2026 renders (CPU and GPU) |