diff --git a/crates/aep/src/export/fx_defs.rs b/crates/aep/src/export/fx_defs.rs index c8b41285c..f91330b75 100644 --- a/crates/aep/src/export/fx_defs.rs +++ b/crates/aep/src/export/fx_defs.rs @@ -728,7 +728,6 @@ mod tests { ("ec.obsolete.gaussianlegacy", "blurriness", 3463), ("ec.perspective.dropshadow", "softness", 3464), ("ec.blur.compound", "maximumBlur", 3465), - ("ec.blur.sharpen", "amount", 3466), ("ec.blur.radial", "amount", 3467), ("ec.blur.ccradial", "amount", 3468), ("ec.time.pixelmotionblur", "shutterAngle", 3481), diff --git a/crates/effects/src/misc.rs b/crates/effects/src/misc.rs index 08c2c5a73..a394b23db 100644 --- a/crates/effects/src/misc.rs +++ b/crates/effects/src/misc.rs @@ -794,7 +794,7 @@ pub fn specs() -> Vec { ], radial, ), - spec("ec.blur.sharpen", "Sharpen", "Blur & Sharpen", vec![p("amount", "Sharpen Amount", num(0.0), slider(0.0, 500.0, 0.0, 100.0, 0))], sharpen), + spec("ec.blur.sharpen", "Sharpen", "Blur & Sharpen", vec![p("amount", "Sharpen Amount", num(0.0), slider(0.0, 4000.0, 0.0, 100.0, 0))], sharpen), spec( "ec.blur.unsharp", "Unsharp Mask", @@ -1055,6 +1055,49 @@ mod tests { } } + /// #3466: Sharpen Amount takes After Effects' valid range, 0..4000, and keeps its 0..100 + /// slider. `prop.set` and the value editors clamp to the hard range. + #[test] + fn sharpen_amount_takes_the_after_effects_range() { + let spec = crate::find("ec.blur.sharpen").unwrap(); + let ui = &spec.params.iter().find(|p| p.id == "amount").unwrap().ui; + assert!( + matches!(ui, ParamUi::Slider { min, max, slider_min, slider_max, .. } + if *min == 0.0 && *max == 4000.0 && *slider_min == 0.0 && *slider_max == 100.0), + "{ui:?}" + ); + } + + /// #3466: at the new top of the range the render stays linear in Amount and finite on 32 bpc + /// over-range input: colour moves away from the blur by Amount / 50 of the difference + /// (2000 → 4000 doubles it), never below 0, and alpha is untouched. + #[test] + fn sharpen_is_linear_and_finite_up_to_amount_4000() { + let mut img = edge(); + for y in 0..8 { + for x in 0..20 { + img.set(x, y, [1000.0, 1000.0, 1000.0, 1.0]); + } + } + let sharpen = |a: f64| run_fx("ec.blur.sharpen", &[("amount", num(a))], img.clone(), 0.0, EffectEnv::default()).img; + let (half, top) = (sharpen(2000.0), sharpen(4000.0)); + for y in 0..8 { + for x in 0..40 { + let (i, h, t) = (img.get(x, y), half.get(x, y), top.get(x, y)); + assert_eq!(t[3], i[3], "alpha at {x}"); + for c in 0..3 { + assert!(t[c].is_finite() && t[c] >= 0.0, "({x}, {y}): {t:?}"); + if t[c] > 0.0 && h[c] > 0.0 { + let (dh, dt) = (h[c] - i[c], t[c] - i[c]); + assert!((dt - 2.0 * dh).abs() <= 1e-3 * dt.abs().max(1.0), "({x}, {y}): {dh} {dt}"); + } + } + } + } + // The bright side of the edge moves 80 × its difference from the blur: far past 10 × the input. + assert!(top.get(19, 4)[0] > 1000.0 * 10.0, "{:?}", top.get(19, 4)); + } + #[test] fn fractional_box_blur_radius_is_continuous() { let row = |v| blurred_row("ec.blur.fastbox", "radius", v); diff --git a/crates/engine/src/tests/effect_ranges.rs b/crates/engine/src/tests/effect_ranges.rs index 5bfe89b21..84d9ac375 100644 --- a/crates/engine/src/tests/effect_ranges.rs +++ b/crates/engine/src/tests/effect_ranges.rs @@ -68,6 +68,7 @@ const ROWS: &[(u32, &str, &str, f64, f64)] = &[ (3492, "ec.distort.ccpowerpin", "expandBottom", -200.0, 1000.0), (3486, "ec.noise.fractal", "subSettings/subScaling", 10.0, 10000.0), (3486, "ec.noise.turbulent", "subSettings/subScaling", 10.0, 10000.0), + (3466, "ec.blur.sharpen", "amount", 0.0, 4000.0), ]; fn path(effect: &str, param: &str) -> String { @@ -169,6 +170,23 @@ fn projects_saved_with_the_narrower_ranges_open_with_the_new_ones() { } } +/// #3466: Sharpen Amount clamps just outside After Effects' 0..4000, and an undo after a +/// clamped set restores the value from before it. +#[test] +fn sharpen_amount_clamps_outside_the_after_effects_range() { + let (mut s, l, _) = session(); + let (e, p) = ("ec.blur.sharpen", "amount"); + for (v, want) in [(4001.0, 4000.0), (-1.0, 0.0)] { + set(&mut s, l, e, p, 1000.0); + assert_eq!(set(&mut s, l, e, p, v), json!(want), "{v}: prop.set reply"); + assert_eq!(read(&mut s, l, e, p), want, "{v}"); + assert!(s.undo()); + assert_eq!(read(&mut s, l, e, p), 1000.0, "{v}: undo"); + assert!(s.redo()); + assert_eq!(read(&mut s, l, e, p), want, "{v}: redo"); + } +} + /// The property at `path` (`group/param`) in an effect instance. fn prop_mut<'a>(g: &'a mut PropGroup, path: &str) -> Option<&'a mut effectcraft_project::Property> { match path.split_once('/') { diff --git a/crates/gpu/src/tests/fx_noise.rs b/crates/gpu/src/tests/fx_noise.rs index 1bfdd9e56..cdb8f1837 100644 --- a/crates/gpu/src/tests/fx_noise.rs +++ b/crates/gpu/src/tests/fx_noise.rs @@ -75,6 +75,8 @@ fn edge_preserving_blurs() { fn sharpen_and_unsharp_mask() { effect_case("ec.blur.sharpen", &[("amount", n(60.0))]); effect_case("ec.blur.sharpen", &[("amount", n(250.0))]); + // #3466: the top of After Effects' range (80 × the difference from the blur). + effect_case("ec.blur.sharpen", &[("amount", n(4000.0))]); effect_case("ec.blur.unsharp", &[("amount", n(120.0)), ("radius", n(4.0))]); effect_case("ec.blur.unsharp", &[("amount", n(80.0)), ("radius", n(2.5)), ("threshold", n(12.0))]); } diff --git a/docs/effects-parity.md b/docs/effects-parity.md index 7ece0ea4d..f9fdd023c 100644 --- a/docs/effects-parity.md +++ b/docs/effects-parity.md @@ -68,6 +68,7 @@ the GPU is performance, not parity. | 2026-11-17 | minor | Turbulent Displace: Amount takes After Effects' recorded valid range, −10000..10000 (default and the −200..200 slider unchanged). Past it (an expression's value) Amount is bounded to 2^24 px and a NaN Amount leaves the layer unchanged, so padding and sampling stay finite (CPU and GPU). Locked pinning on a layer under a pixel across no longer crashes | | 2026-11-17 | minor | Fractal and Turbulent Noise: Sub Scaling takes After Effects' 10..10000 (slider and default unchanged), and above 100 each octave is larger than the last instead of being capped at 100; octave scales stay finite at Complexity 20 (CPU and GPU) | | 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-17 | minor | Sharpen: Amount takes After Effects' recorded valid range, 0..4000 (was 0..500; default and the 0..100 slider unchanged). Sharpen stays linear in Amount and finite up to 4000, CPU and GPU agree there | | 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) |