From d918aa6e13bf6a89e81d974f20a85826540ece54 Mon Sep 17 00:00:00 2001 From: arnav-hiwarkar Date: Tue, 17 Nov 2026 16:09:29 +0530 Subject: [PATCH 1/3] #3467: Radial Blur Amount takes After Effects' range 0..1000 After Effects records 0..1000 for Radial Blur's Amount (slider 0..100); EffectCraft's hard range stopped at 100, so prop.set and the value editors clamped 200 to 100. The hard maximum is now 1000; the slider range and default are unchanged. The engine range test covers prop.set at both ends, undo and redo, save and reopen, and a project saved with the old range. The parameter leaves the .aep range guard's list of known narrower ranges. --- crates/aep/src/export/fx_defs.rs | 1 - crates/effects/src/misc.rs | 27 +++++++++++++++++++++++- crates/engine/src/tests/effect_ranges.rs | 1 + 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/crates/aep/src/export/fx_defs.rs b/crates/aep/src/export/fx_defs.rs index 338e00fc5..fb83eed8a 100644 --- a/crates/aep/src/export/fx_defs.rs +++ b/crates/aep/src/export/fx_defs.rs @@ -730,7 +730,6 @@ mod tests { ("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.distort.turbulentdisplace", "amount", 3469), ("ec.time.pixelmotionblur", "shutterAngle", 3481), diff --git a/crates/effects/src/misc.rs b/crates/effects/src/misc.rs index 9c7131657..168dd6110 100644 --- a/crates/effects/src/misc.rs +++ b/crates/effects/src/misc.rs @@ -786,7 +786,8 @@ pub fn specs() -> Vec { "Radial Blur", "Blur & Sharpen", vec![ - p("amount", "Amount", num(10.0), slider(0.0, 100.0, 0.0, 100.0, 1)), + // After Effects accepts 0..1000; its slider shows 0..100 (#3467). + p("amount", "Amount", num(10.0), slider(0.0, 1000.0, 0.0, 100.0, 1)), p("center", "Center", Value::Vec2([0.5, 0.5]), ParamUi::Point), p("type", "Type", Value::Enum(0), popup(&["Spin", "Zoom"])), // Our blur is always fully anti-aliased; the choice is kept for compatibility. @@ -1147,6 +1148,30 @@ mod tests { } } + /// Spin and Zoom at both ends of Amount (0..1000) and both Antialiasing settings give finite + /// colours over an opaque layer and keep it opaque (#3467). + #[test] + fn radial_blur_is_finite_across_the_amount_range() { + let mut img = effectcraft_raster::Image::new(48, 40); + img.rows_mut().for_each(|(y, row)| { + for (x, px) in row.iter_mut().enumerate() { + *px = [x as f32 / 47.0, y as f32 / 39.0, 0.5, 1.0]; + } + }); + for ty in 0..2 { + for aa in 0..2 { + for amount in [0.0, 100.0, 200.0, 1000.0] { + let vals = [("amount", num(amount)), ("type", Value::Enum(ty)), ("center", Value::Vec2([10.0, 30.0])), ("antialiasing", Value::Enum(aa))]; + let o = run_fx("ec.blur.radial", &vals, img.clone(), 0.0, EffectEnv::default()); + assert_eq!((o.img.width, o.img.height), (48, 40)); + for p in &o.img.data { + assert!(p.iter().all(|v| v.is_finite()) && (p[3] - 1.0).abs() < 1e-5, "type {ty} aa {aa} amount {amount}: {p:?}"); + } + } + } + } + } + /// After Effects 2026, Venetian Blinds Completion 40, Direction 30, Width 50, Feather 5 on /// an opaque 480 × 270 layer: alpha (0..255) along row y = 135. The transparent band starts /// at the layer centre's phase, both edges are Gaussian (σ = Feather / 2). diff --git a/crates/engine/src/tests/effect_ranges.rs b/crates/engine/src/tests/effect_ranges.rs index 7deaaa911..6cc457888 100644 --- a/crates/engine/src/tests/effect_ranges.rs +++ b/crates/engine/src/tests/effect_ranges.rs @@ -60,6 +60,7 @@ const ROWS: &[(u32, &str, &str, f64, f64)] = &[ (3471, "ec.distort.transform", "scaleHeight", -30000.0, 30000.0), (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), ]; fn path(effect: &str, param: &str) -> String { From f98c3e9ba2da86ced94a34f7c9bf1a1fe7489d33 Mon Sep 17 00:00:00 2001 From: arnav-hiwarkar Date: Tue, 17 Nov 2026 16:09:38 +0530 Subject: [PATCH 2/3] #3467: Radial Blur Zoom past 200 stays on its side of the centre MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Zoom spreads its 32 samples over scales 1 ± Amount / 200 about the centre. Past Amount 200, which the range now allows, that reaches below 0 and samples the layer mirrored through the centre: at 1000 a layer white on the left and black on the right turned the right half 35 % grey. raster::radial_blur_zoom_scale keeps the old scales up to 200 exactly and spreads the samples evenly from the centre to 1 + Amount / 200 beyond. The CPU and GPU paths both take their samples from it. Work per pixel stays at 32 samples at any Amount. --- crates/effects/src/misc.rs | 20 +++++++++++ crates/gpu/src/fx_generate.rs | 8 ++--- crates/gpu/src/tests/fx_generate.rs | 3 ++ crates/raster/src/blur.rs | 53 ++++++++++++++++++++++++++--- crates/raster/src/lib.rs | 5 ++- docs/effects-parity.md | 1 + 6 files changed, 81 insertions(+), 9 deletions(-) diff --git a/crates/effects/src/misc.rs b/crates/effects/src/misc.rs index 168dd6110..ea196fc11 100644 --- a/crates/effects/src/misc.rs +++ b/crates/effects/src/misc.rs @@ -1148,6 +1148,26 @@ mod tests { } } + /// Amount takes After Effects' valid range up to 1000 (#3467), Zoom 1000 a spread of 10. + /// Zoom samples along the ray from the centre through the pixel, never past the centre: on a + /// layer white left of the centre and black right of it, the right half stays black (scales + /// below 0 sampled the white half mirrored through the centre). Both Antialiasing settings. + #[test] + fn radial_blur_zoom_at_the_largest_amount_stays_on_its_side_of_the_centre() { + let mut img = effectcraft_raster::Image::filled(64, 32, [0.0, 0.0, 0.0, 1.0]); + img.rows_mut().for_each(|(_, row)| row.iter_mut().take(32).for_each(|px| *px = [1.0, 1.0, 1.0, 1.0])); + for aa in 0..2 { + let vals = [("amount", num(1000.0)), ("type", Value::Enum(1)), ("center", Value::Vec2([32.5, 16.5])), ("antialiasing", Value::Enum(aa))]; + let o = run_fx("ec.blur.radial", &vals, img.clone(), 0.0, EffectEnv::default()); + for y in 0..32 { + for x in 33..64 { + let p = o.img.get(x, y); + assert!(p[0].abs() < 1e-5 && (p[3] - 1.0).abs() < 1e-5, "aa {aa} ({x}, {y}): {p:?}"); + } + } + } + } + /// Spin and Zoom at both ends of Amount (0..1000) and both Antialiasing settings give finite /// colours over an opaque layer and keep it opaque (#3467). #[test] diff --git a/crates/gpu/src/fx_generate.rs b/crates/gpu/src/fx_generate.rs index 2dda38f45..6e9594f60 100644 --- a/crates/gpu/src/fx_generate.rs +++ b/crates/gpu/src/fx_generate.rs @@ -100,14 +100,14 @@ fn radial_blur(e: &mut Enc, ctx: &EffectCtx, b: GBuf) -> Option { if amount.abs() < 1e-6 { return Some(b); } - let n = 32usize; + // The CPU's samples (`raster::radial_blur`). + let n = effectcraft_raster::RADIAL_BLUR_SAMPLES; let mut data = Vec::with_capacity(2 * n); for i in 0..n { - let t = i as f64 / (n - 1) as f64 - 0.5; if zoom { - data.push((1.0 + t * amount) as f32); + data.push(effectcraft_raster::radial_blur_zoom_scale(i, amount) as f32); } else { - let (s, c) = (t * amount).to_radians().sin_cos(); + let (s, c) = effectcraft_raster::radial_blur_spin_angle(i, amount).to_radians().sin_cos(); data.extend([s as f32, c as f32]); } } diff --git a/crates/gpu/src/tests/fx_generate.rs b/crates/gpu/src/tests/fx_generate.rs index f8482b5ab..02ec75b11 100644 --- a/crates/gpu/src/tests/fx_generate.rs +++ b/crates/gpu/src/tests/fx_generate.rs @@ -24,6 +24,9 @@ fn radial_blur() { effect_case("ec.blur.radial", &[("amount", n(12.0))]); effect_case("ec.blur.radial", &[("amount", n(30.0)), ("type", e(1)), ("center", pt(20.3, 14.7))]); effect_case("ec.blur.radial", &[("amount", n(-45.0)), ("center", pt(50.0, 30.0))]); + // Amount's largest value, 1000 (#3467): Spin over ±500°, Zoom from the centre outwards. + effect_case("ec.blur.radial", &[("amount", n(1000.0)), ("center", pt(20.3, 14.7))]); + effect_case("ec.blur.radial", &[("amount", n(1000.0)), ("type", e(1)), ("center", pt(20.3, 14.7)), ("antialiasing", e(1))]); } #[test] diff --git a/crates/raster/src/blur.rs b/crates/raster/src/blur.rs index 76e51f865..751e0f5d0 100644 --- a/crates/raster/src/blur.rs +++ b/crates/raster/src/blur.rs @@ -300,24 +300,49 @@ pub fn directional_blur(img: &Image, angle_deg: f64, length: f64) -> Image { out } +/// Samples [`radial_blur`] averages per pixel at every amount, so the work per pixel stays the +/// same up to Radial Blur's largest Amount (1000). The GPU path takes the same count. +pub const RADIAL_BLUR_SAMPLES: usize = 32; + +/// Where sample `i` of [`RADIAL_BLUR_SAMPLES`] lies in the blur's spread, from −0.5 to 0.5. +fn radial_blur_t(i: usize) -> f64 { + i as f64 / (RADIAL_BLUR_SAMPLES - 1) as f64 - 0.5 +} + +/// Spin sample `i`'s rotation in degrees for a spin of `amount` degrees. +pub fn radial_blur_spin_angle(i: usize, amount: f64) -> f64 { + radial_blur_t(i) * amount +} + +/// Zoom sample `i`'s scale about the centre for a zoom of `amount` (a fraction of the distance +/// to the centre): evenly over `1 ± amount / 2`. Past a spread of 2 (Radial Blur's Amount 200) +/// that would reach below 0 and sample the point mirrored through the centre, so the samples +/// spread evenly from the centre (0) to `1 + amount / 2` instead (#3467). +pub fn radial_blur_zoom_scale(i: usize, amount: f64) -> f64 { + let t = radial_blur_t(i); + if amount.abs() <= 2.0 { + return 1.0 + t * amount; + } + (t + 0.5) * (1.0 + amount.abs() / 2.0) +} + /// Radial blur around `center`: `spin` (degrees) or zoom (`amount` as a fraction of distance). pub fn radial_blur(img: &Image, center: (f64, f64), amount: f64, zoom: bool) -> Image { if amount.abs() < 1e-6 { return img.clone(); } - let n = 32usize; + let n = RADIAL_BLUR_SAMPLES; let mut out = Image::new(img.width, img.height); out.rows_mut().for_each(|(y, row)| { for (x, px) in row.iter_mut().enumerate() { let (vx, vy) = (x as f64 + 0.5 - center.0, y as f64 + 0.5 - center.1); let mut acc = [0.0f32; 4]; for i in 0..n { - let t = i as f64 / (n - 1) as f64 - 0.5; let (sx, sy) = if zoom { - let k = 1.0 + t * amount; + let k = radial_blur_zoom_scale(i, amount); (center.0 + vx * k, center.1 + vy * k) } else { - let (s, c) = (t * amount).to_radians().sin_cos(); + let (s, c) = radial_blur_spin_angle(i, amount).to_radians().sin_cos(); (center.0 + vx * c - vy * s, center.1 + vx * s + vy * c) }; // Samples outside the image repeat its edge: After Effects' Radial Blur keeps a @@ -337,6 +362,26 @@ pub fn radial_blur(img: &Image, center: (f64, f64), amount: f64, zoom: bool) -> mod tests { use super::*; + /// Zoom spreads up to 2 keep `1 ± spread / 2` exactly as before (#3467); wider ones run + /// from the centre (scale 0) out to `1 + spread / 2`, evenly and never below 0. + #[test] + fn radial_blur_zoom_scales_never_cross_the_centre() { + let n = RADIAL_BLUR_SAMPLES; + for amount in [0.2, 1.0, 2.0, -1.5] { + for i in 0..n { + let t = i as f64 / (n - 1) as f64 - 0.5; + assert_eq!(radial_blur_zoom_scale(i, amount), 1.0 + t * amount, "amount {amount} sample {i}"); + } + } + for amount in [2.5, 10.0, -10.0] { + let k: Vec = (0..n).map(|i| radial_blur_zoom_scale(i, amount)).collect(); + assert_eq!(k[0], 0.0, "amount {amount}"); + assert!((k[n - 1] - (1.0 + amount.abs() / 2.0)).abs() < 1e-12, "amount {amount}: {k:?}"); + let step = k[n - 1] / (n - 1) as f64; + assert!(k.windows(2).all(|w| (w[1] - w[0] - step).abs() < 1e-12), "amount {amount}: {k:?}"); + } + } + /// The sampled Gaussian pass as it was (one pixel at a time, bounds-checked taps): the /// row-wise passes must match it to the bit. fn gauss_pass_per_pixel(img: &Image, sigma: f64, vertical: bool, repeat: bool) -> Image { diff --git a/crates/raster/src/lib.rs b/crates/raster/src/lib.rs index e18a24c63..852065db4 100644 --- a/crates/raster/src/lib.rs +++ b/crates/raster/src/lib.rs @@ -17,7 +17,10 @@ pub mod yuv; use effectcraft_color::{BlendMode, blend_pixel}; use rayon::prelude::*; -pub use blur::{box_blur, directional_blur, gaussian_blur, gaussian_blur_exact, gaussian_is_exact, radial_blur}; +pub use blur::{ + RADIAL_BLUR_SAMPLES, box_blur, directional_blur, gaussian_blur, gaussian_blur_exact, gaussian_is_exact, radial_blur, radial_blur_spin_angle, + radial_blur_zoom_scale, +}; pub use channels3d::AuxChannels; pub use warp::{Sampling, WarpOpts, accumulate_warp, composite_warp, composite_warp_changed, composite_warp_reference, resample}; diff --git a/docs/effects-parity.md b/docs/effects-parity.md index b07c624f8..9d6ca232f 100644 --- a/docs/effects-parity.md +++ b/docs/effects-parity.md @@ -64,6 +64,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) | | 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) | From d5e74c880fd779fef635a01993eafaed70f7b0b6 Mon Sep 17 00:00:00 2001 From: arnav-hiwarkar Date: Tue, 17 Nov 2026 16:15:51 +0530 Subject: [PATCH 3/3] #3467: Radial Blur docs say the wide Zoom shape is unmeasured The spin helper's name gives its unit (degrees), the zoom helper's doc uses |amount| as the code does, and the parity row and tests say what is and is not checked against After Effects. --- crates/effects/src/misc.rs | 6 ++++-- crates/gpu/src/fx_generate.rs | 2 +- crates/raster/src/blur.rs | 7 ++++--- crates/raster/src/lib.rs | 2 +- docs/effects-parity.md | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/crates/effects/src/misc.rs b/crates/effects/src/misc.rs index ea196fc11..69a30505a 100644 --- a/crates/effects/src/misc.rs +++ b/crates/effects/src/misc.rs @@ -1151,7 +1151,8 @@ mod tests { /// Amount takes After Effects' valid range up to 1000 (#3467), Zoom 1000 a spread of 10. /// Zoom samples along the ray from the centre through the pixel, never past the centre: on a /// layer white left of the centre and black right of it, the right half stays black (scales - /// below 0 sampled the white half mirrored through the centre). Both Antialiasing settings. + /// below 0 sampled the white half mirrored through the centre). Both Antialiasing settings (the + /// renderer does not read it yet; the test keeps both covered). #[test] fn radial_blur_zoom_at_the_largest_amount_stays_on_its_side_of_the_centre() { let mut img = effectcraft_raster::Image::filled(64, 32, [0.0, 0.0, 0.0, 1.0]); @@ -1169,7 +1170,8 @@ mod tests { } /// Spin and Zoom at both ends of Amount (0..1000) and both Antialiasing settings give finite - /// colours over an opaque layer and keep it opaque (#3467). + /// colours over an opaque layer and keep it opaque (#3467). It guards the newly accepted + /// values; it passed before the Zoom fix too. #[test] fn radial_blur_is_finite_across_the_amount_range() { let mut img = effectcraft_raster::Image::new(48, 40); diff --git a/crates/gpu/src/fx_generate.rs b/crates/gpu/src/fx_generate.rs index 6e9594f60..8833e4d46 100644 --- a/crates/gpu/src/fx_generate.rs +++ b/crates/gpu/src/fx_generate.rs @@ -107,7 +107,7 @@ fn radial_blur(e: &mut Enc, ctx: &EffectCtx, b: GBuf) -> Option { if zoom { data.push(effectcraft_raster::radial_blur_zoom_scale(i, amount) as f32); } else { - let (s, c) = effectcraft_raster::radial_blur_spin_angle(i, amount).to_radians().sin_cos(); + let (s, c) = effectcraft_raster::radial_blur_spin_degrees(i, amount).to_radians().sin_cos(); data.extend([s as f32, c as f32]); } } diff --git a/crates/raster/src/blur.rs b/crates/raster/src/blur.rs index 751e0f5d0..9c9e7ec34 100644 --- a/crates/raster/src/blur.rs +++ b/crates/raster/src/blur.rs @@ -310,14 +310,15 @@ fn radial_blur_t(i: usize) -> f64 { } /// Spin sample `i`'s rotation in degrees for a spin of `amount` degrees. -pub fn radial_blur_spin_angle(i: usize, amount: f64) -> f64 { +pub fn radial_blur_spin_degrees(i: usize, amount: f64) -> f64 { radial_blur_t(i) * amount } /// Zoom sample `i`'s scale about the centre for a zoom of `amount` (a fraction of the distance /// to the centre): evenly over `1 ± amount / 2`. Past a spread of 2 (Radial Blur's Amount 200) /// that would reach below 0 and sample the point mirrored through the centre, so the samples -/// spread evenly from the centre (0) to `1 + amount / 2` instead (#3467). +/// spread evenly from the centre (0) to `1 + |amount| / 2` instead (#3467). That wider shape is +/// EffectCraft's; After Effects has not been measured past Amount 200. pub fn radial_blur_zoom_scale(i: usize, amount: f64) -> f64 { let t = radial_blur_t(i); if amount.abs() <= 2.0 { @@ -342,7 +343,7 @@ pub fn radial_blur(img: &Image, center: (f64, f64), amount: f64, zoom: bool) -> let k = radial_blur_zoom_scale(i, amount); (center.0 + vx * k, center.1 + vy * k) } else { - let (s, c) = radial_blur_spin_angle(i, amount).to_radians().sin_cos(); + let (s, c) = radial_blur_spin_degrees(i, amount).to_radians().sin_cos(); (center.0 + vx * c - vy * s, center.1 + vx * s + vy * c) }; // Samples outside the image repeat its edge: After Effects' Radial Blur keeps a diff --git a/crates/raster/src/lib.rs b/crates/raster/src/lib.rs index 852065db4..58feead1a 100644 --- a/crates/raster/src/lib.rs +++ b/crates/raster/src/lib.rs @@ -18,7 +18,7 @@ use effectcraft_color::{BlendMode, blend_pixel}; use rayon::prelude::*; pub use blur::{ - RADIAL_BLUR_SAMPLES, box_blur, directional_blur, gaussian_blur, gaussian_blur_exact, gaussian_is_exact, radial_blur, radial_blur_spin_angle, + RADIAL_BLUR_SAMPLES, box_blur, directional_blur, gaussian_blur, gaussian_blur_exact, gaussian_is_exact, radial_blur, radial_blur_spin_degrees, radial_blur_zoom_scale, }; pub use channels3d::AuxChannels; diff --git a/docs/effects-parity.md b/docs/effects-parity.md index 9d6ca232f..1ef31c413 100644 --- a/docs/effects-parity.md +++ b/docs/effects-parity.md @@ -64,7 +64,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) | +| 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-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) |