From 2e17ed1d832a49e2f01beb7c510114561f92fa05 Mon Sep 17 00:00:00 2001 From: arnav-hiwarkar Date: Tue, 17 Nov 2026 16:12:25 +0530 Subject: [PATCH 1/4] #3469: Turbulent Displace Amount takes After Effects' valid range The hard range was -1000..1000, so prop.set and the Effect Controls and Timeline editors clamped Amount values After Effects accepts. The recorded ADBE Turbulent Displace definition allows -10000..10000 (plain units, no conversion). The default and the -200..200 slider are unchanged. The .aep range guard no longer lists the parameter as narrower, and the engine range test covers both ends through prop.set, undo/redo, save and reopen, and projects saved with the old range. --- crates/aep/src/export/fx_defs.rs | 1 - crates/effects/src/distort2.rs | 12 +++++++++++- crates/engine/src/tests/effect_ranges.rs | 1 + docs/effects-parity.md | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/aep/src/export/fx_defs.rs b/crates/aep/src/export/fx_defs.rs index 338e00fc5..527ef62f8 100644 --- a/crates/aep/src/export/fx_defs.rs +++ b/crates/aep/src/export/fx_defs.rs @@ -732,7 +732,6 @@ mod tests { ("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), ("ec.time.pixelmotionblur", "shutterSamples", 3482), ("ec.noise.fractal", "subSettings/subInfluence", 3485), diff --git a/crates/effects/src/distort2.rs b/crates/effects/src/distort2.rs index 611cb6dcf..4d0e5d7ec 100644 --- a/crates/effects/src/distort2.rs +++ b/crates/effects/src/distort2.rs @@ -736,7 +736,7 @@ pub fn specs() -> Vec { "Turbulent Displace", vec![ p("displacement", "Displacement", Value::Enum(0), popup(&TURBULENT_KINDS)), - p("amount", "Amount", num(50.0), slider(-1000.0, 1000.0, -200.0, 200.0, 1)), + p("amount", "Amount", num(50.0), slider(-10000.0, 10000.0, -200.0, 200.0, 1)), p("size", "Size", num(100.0), slider(2.0, 4000.0, 2.0, 400.0, 1)), p("offset", "Offset (Turbulence)", pt(0.5, 0.5), ParamUi::Point), p("complexity", "Complexity", num(1.0), slider(1.0, 10.0, 1.0, 10.0, 1)), @@ -1010,6 +1010,16 @@ mod tests { assert!(max_diff(&run("ec.distort.turbulentdisplace", &[], img.clone()).img, &img) > 1e-3); } + /// #3469: Amount's hard range is After Effects' recorded valid range, -10000..10000; the + /// slider keeps its -200..200 scrub range. + #[test] + fn turbulent_displace_amount_takes_the_after_effects_range() { + let spec = crate::find("ec.distort.turbulentdisplace").unwrap(); + let amount = spec.params.iter().find(|p| p.id == "amount").unwrap(); + let ParamUi::Slider { min, max, slider_min, slider_max, .. } = amount.ui else { panic!("{:?}", amount.ui) }; + assert_eq!((min, max, slider_min, slider_max), (-10000.0, 10000.0, -200.0, 200.0)); + } + #[test] fn griddler_default_is_identity() { let img = test_img(32, 24); diff --git a/crates/engine/src/tests/effect_ranges.rs b/crates/engine/src/tests/effect_ranges.rs index 7deaaa911..5436d4f32 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), + (3469, "ec.distort.turbulentdisplace", "amount", -10000.0, 10000.0), ]; fn path(effect: &str, param: &str) -> String { diff --git a/docs/effects-parity.md b/docs/effects-parity.md index b07c624f8..f2c827432 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 | Turbulent Displace: Amount takes After Effects' recorded valid range, −10000..10000 (default and the −200..200 slider unchanged) | | 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 040fe61b84ad59548cc1bf876c6260443b88b2b7 Mon Sep 17 00:00:00 2001 From: arnav-hiwarkar Date: Tue, 17 Nov 2026 16:13:10 +0530 Subject: [PATCH 2/4] #3469: Turbulent Displace stays finite at any Amount Expressions are not clamped to the hard range. Padding computed amount.abs().ceil() as u32 + 1, which overflowed (a panic in debug builds) from about 4.3e9 on both the CPU and GPU paths, a NaN Amount filled the layer with NaN, and an infinite one sent infinite coordinates to the samplers' integer pixel positions. turbulent_amount_px, shared by both paths, skips a zero or NaN Amount and bounds the rest to 2^24 px. Values inside the hard range are unchanged. Tests cover both ends of the range with every displacement kind, pinning and Resize Layer (finite, padding within budget), Amounts past it, and CPU/GPU agreement at -10000, 10000 and infinity. --- crates/effects/src/distort2.rs | 59 ++++++++++++++++++++++++++++-- crates/effects/src/lib.rs | 2 +- crates/gpu/src/fx_distort.rs | 5 +-- crates/gpu/src/tests/fx_distort.rs | 8 ++++ docs/effects-parity.md | 2 +- 5 files changed, 68 insertions(+), 8 deletions(-) diff --git a/crates/effects/src/distort2.rs b/crates/effects/src/distort2.rs index 4d0e5d7ec..ed04c3493 100644 --- a/crates/effects/src/distort2.rs +++ b/crates/effects/src/distort2.rs @@ -85,11 +85,24 @@ const TURBULENT_PINNING: [&str; 15] = [ "Pin Bottom Locked", ]; +/// The largest Amount, in buffer pixels, Turbulent Displace displaces by: 2^24, exact in f32. +/// Only an expression gets past the -10000..10000 hard range. At this bound nearly every sample +/// already lands far outside any buffer, and the padding and the CPU and GPU samplers' integer +/// pixel positions (the gradient kinds move up to 2.5 × Amount) stay in range. +const TURBULENT_MAX_AMOUNT_PX: f64 = 16_777_216.0; + +/// Turbulent Displace's Amount at `scale`, in buffer pixels, bounded to +/// ±[`TURBULENT_MAX_AMOUNT_PX`]; `None` when nothing moves (zero, or not a number). Shared with +/// the GPU path. +pub fn turbulent_amount_px(ctx: &EffectCtx, scale: f64) -> Option { + let amount = ctx.params.f("amount") * scale; + (amount.abs() >= 1e-9).then(|| amount.clamp(-TURBULENT_MAX_AMOUNT_PX, TURBULENT_MAX_AMOUNT_PX)) +} + fn turbulent_displace(ctx: &EffectCtx, mut b: Buf) -> Buf { - let amount = ctx.params.f("amount") * b.scale; - if amount.abs() < 1e-9 { + let Some(amount) = turbulent_amount_px(ctx, b.scale) else { return b; - } + }; // TURBULENT_KINDS order: the "Smoother" variants (3, 4, 5) use a gentler octave falloff. let kind = ctx.params.e("displacement"); let size = (ctx.params.f("size") * b.scale).max(1.0); @@ -1020,6 +1033,46 @@ mod tests { assert_eq!((min, max, slider_min, slider_max), (-10000.0, 10000.0, -200.0, 200.0)); } + /// #3469: at either end of Amount's range, with every displacement kind, resized or not and + /// pinned or not, the output stays finite, in its alpha range and within the padding budget. + #[test] + fn turbulent_displace_extreme_amounts_stay_finite_and_bounded() { + let img = test_img(32, 24); + // Resize Layer grows the buffer to the padding budget (16 Mpx here), so it runs with two + // kinds; the rest stay layer-sized. + let cases = (0..9).flat_map(|kind| [(kind, 0, 0.0), (kind, 1, 0.0), (kind, 8, 0.0)]).chain([(0, 3, 1.0), (4, 14, 1.0)]); + for amount in [-10000.0, 10000.0] { + for (kind, pin, resize) in cases.clone() { + let set = [("amount", num(amount)), ("displacement", Value::Enum(kind)), ("pinning", Value::Enum(pin)), ("resizeLayer", num(resize))]; + let o = run("ec.distort.turbulentdisplace", &set, img.clone()); + let what = format!("amount {amount} kind {kind} pinning {pin} resize {resize}"); + assert!(o.img.data.iter().all(|p| p.iter().all(|v| v.is_finite()) && (0.0..=1.0 + 1e-5).contains(&p[3])), "{what}"); + let area = u64::from(o.img.width) * u64::from(o.img.height); + assert!(area <= 16_777_216, "{what}: {}x{}", o.img.width, o.img.height); + } + } + } + + /// #3469: an Amount past the hard range, which only an expression produces, renders without + /// overflowing the padding or the sampler's pixel positions and stays finite (a plain, a + /// gradient and the cross kind; unpinned, pinned and locked); one that is not a number leaves + /// the layer as it is. + #[test] + fn turbulent_displace_unbounded_amounts_do_not_crash() { + let img = test_img(32, 24); + let cases = [0, 1, 8].into_iter().flat_map(|kind| [(kind, 0, 0.0), (kind, 1, 0.0), (kind, 11, 0.0)]).chain([(0, 1, 1.0)]); + for amount in [1e12, -1e300, f64::MAX, f64::INFINITY, f64::NEG_INFINITY] { + for (kind, pin, resize) in cases.clone() { + let set = [("amount", num(amount)), ("displacement", Value::Enum(kind)), ("pinning", Value::Enum(pin)), ("resizeLayer", num(resize))]; + let o = run("ec.distort.turbulentdisplace", &set, img.clone()); + assert!(o.img.data.iter().all(|p| p.iter().all(|v| v.is_finite())), "{amount} kind {kind} pinning {pin} resize {resize}"); + } + } + for resize in [0.0, 1.0] { + assert_eq!(run("ec.distort.turbulentdisplace", &[("amount", num(f64::NAN)), ("resizeLayer", num(resize))], img.clone()).img, img); + } + } + #[test] fn griddler_default_is_identity() { let img = test_img(32, 24); diff --git a/crates/effects/src/lib.rs b/crates/effects/src/lib.rs index 5da2035ac..1e1003e7e 100644 --- a/crates/effects/src/lib.rs +++ b/crates/effects/src/lib.rs @@ -84,7 +84,7 @@ pub use color_fx::{COLORAMA_PRESETS, ColoramaPalette}; pub use color2::{Curve, auto_correct_settings, color_link_mode, color_link_sample, equalize_tables, luma_clip_points, shadow_highlight_amounts}; pub use color3::OffsetCurve; pub use distort::{transform_grow, transform_matrix_px, transform_shutter}; -pub use distort2::{MAGNIFY_MODES, bezier_grid, parse_mesh}; +pub use distort2::{MAGNIFY_MODES, bezier_grid, parse_mesh, turbulent_amount_px}; pub use distort3::{RESHAPE_POINTS, ReshapeSetup, SmearSetup, cc_smear_pad, reshape_setup, smear_setup, warp_inverse_map}; pub use distort4::liquify_mesh; use effectcraft_keyframe::Value; diff --git a/crates/gpu/src/fx_distort.rs b/crates/gpu/src/fx_distort.rs index 510f91e8c..cc25d3106 100644 --- a/crates/gpu/src/fx_distort.rs +++ b/crates/gpu/src/fx_distort.rs @@ -172,10 +172,9 @@ fn cc_lens(e: &mut Enc, ctx: &EffectCtx, b: GBuf) -> Option { } fn turbulent(e: &mut Enc, ctx: &EffectCtx, mut b: GBuf) -> Option { - let amount = ctx.params.f("amount") * b.scale; - if amount.abs() < 1e-9 { + let Some(amount) = effectcraft_effects::turbulent_amount_px(ctx, b.scale) else { return Some(b); - } + }; let kind = ctx.params.e("displacement"); let size = (ctx.params.f("size") * b.scale).max(1.0); if ctx.params.b("resizeLayer") && !ctx.adjustment { diff --git a/crates/gpu/src/tests/fx_distort.rs b/crates/gpu/src/tests/fx_distort.rs index 6fc18f3c9..e5e3ceca9 100644 --- a/crates/gpu/src/tests/fx_distort.rs +++ b/crates/gpu/src/tests/fx_distort.rs @@ -57,6 +57,14 @@ fn turbulent_displace_and_cc_lens() { ], ); effect_case("ec.distort.turbulentdisplace", &[("displacement", e(8)), ("size", n(15.0)), ("pinning", e(6))]); + // #3469: both ends of After Effects' Amount range, resized and pinned, and an expression's + // Amount past it. + effect_case("ec.distort.turbulentdisplace", &[("size", n(30.0)), ("amount", n(10000.0))]); + effect_case( + "ec.distort.turbulentdisplace", + &[("displacement", e(1)), ("size", n(25.0)), ("amount", n(-10000.0)), ("pinning", e(1)), ("resizeLayer", on())], + ); + effect_case("ec.distort.turbulentdisplace", &[("displacement", e(7)), ("amount", n(f64::INFINITY)), ("pinning", e(2))]); // #943: Evolution moves the pattern at a constant rate on both paths, including steps of a // few degrees and angles past a whole revolution, where an eased evolution axis diverges. for evolution in [10.0, 37.0, 400.0, 725.5] { diff --git a/docs/effects-parity.md b/docs/effects-parity.md index f2c827432..c438eedbb 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 | Turbulent Displace: Amount takes After Effects' recorded valid range, −10000..10000 (default and the −200..200 slider unchanged) | +| 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) the displacement is bounded to 2^24 px and a NaN Amount leaves the layer unchanged, so padding and sampling stay finite (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 4cf774134000e34f837f54584465161736da210d Mon Sep 17 00:00:00 2001 From: arnav-hiwarkar Date: Tue, 17 Nov 2026 16:14:01 +0530 Subject: [PATCH 3/4] #3469: Turbulent Displace locked pinning on a sub-pixel layer Locked pinning clamped samples to lx + 0.5 .. lx + lw - 0.5. On a layer under a buffer pixel across (a 1-pixel layer at half resolution) the bounds cross and f64::clamp panics. They now meet at the layer's centre there and are unchanged otherwise. --- crates/effects/src/distort2.rs | 21 ++++++++++++++++++++- docs/effects-parity.md | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/effects/src/distort2.rs b/crates/effects/src/distort2.rs index ed04c3493..8ca2f2d72 100644 --- a/crates/effects/src/distort2.rs +++ b/crates/effects/src/distort2.rs @@ -123,6 +123,10 @@ fn turbulent_displace(ctx: &EffectCtx, mut b: Buf) -> Buf { let falloff = if (3..=5).contains(&kind) { 0.3 } else { 0.5 }; let (lx, ly, lw, lh) = layer_rect(ctx, &b); let edge = (lw.min(lh) * if locked { 0.25 } else { 0.1 }).max(1.0); + // Locked: samples stay between the outermost pixel centres, or at the centre of a layer under + // a pixel across (half resolution), whose bounds would otherwise cross. + let (ix, iy) = (0.5f64.min(lw * 0.5), 0.5f64.min(lh * 0.5)); + let lock = (lx + ix, lx + lw - ix, ly + iy, ly + lh - iy); let seed = (ctx.seed ^ 0x7d15).wrapping_add((ctx.params.f("evolutionOptions/randomSeed") as i64 as u32).wrapping_mul(0x9e37_79b9)); let n = |u: f64, v: f64, s: u32| { let s = seed.wrapping_add(s); @@ -169,7 +173,7 @@ fn turbulent_displace(ctx: &EffectCtx, mut b: Buf) -> Buf { }; let (sx, sy) = (x + dx * k, y + dy * k); if locked { - return Some((sx.clamp(lx + 0.5, lx + lw - 0.5), sy.clamp(ly + 0.5, ly + lh - 0.5))); + return Some((sx.clamp(lock.0, lock.1), sy.clamp(lock.2, lock.3))); } Some((sx, sy)) }); @@ -1073,6 +1077,21 @@ mod tests { } } + /// #3469: a locked pinning on a layer under a buffer pixel across (a 1-pixel layer at half + /// resolution) keeps samples inside it without inverted clamp bounds, at any Amount. + #[test] + fn turbulent_displace_locked_pinning_on_a_subpixel_layer_does_not_crash() { + let spec = crate::find("ec.distort.turbulentdisplace").unwrap(); + for amount in [-10000.0, 50.0, 10000.0] { + let mut params = Params { values: spec.params.iter().map(|p| (p.id.to_string(), p.default.clone())).collect() }; + params.values.insert("amount".into(), num(amount)); + params.values.insert("pinning".into(), Value::Enum(8)); + let ctx = EffectCtx { params: ¶ms, time: 0.5, layer_size: [1.0, 1.0], seed: 3, adjustment: false, env: Default::default() }; + let o = crate::apply(spec, &ctx, Buf { img: test_img(1, 1), offset: [0.0, 0.0], scale: 0.5 }); + assert!(o.img.data.iter().all(|p| p.iter().all(|v| v.is_finite())), "{amount}"); + } + } + #[test] fn griddler_default_is_identity() { let img = test_img(32, 24); diff --git a/docs/effects-parity.md b/docs/effects-parity.md index c438eedbb..d109da598 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 | Turbulent Displace: Amount takes After Effects' recorded valid range, −10000..10000 (default and the −200..200 slider unchanged). Past it (an expression's value) the displacement is bounded to 2^24 px and a NaN Amount leaves the layer unchanged, so padding and sampling stay finite (CPU and GPU) | +| 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) the displacement 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-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 a62564b567befbf3d0f9410cfb553454d5d610b0 Mon Sep 17 00:00:00 2001 From: arnav-hiwarkar Date: Tue, 17 Nov 2026 16:19:44 +0530 Subject: [PATCH 4/4] #3469: locked pinning clamps without f64::clamp The sub-pixel bounds lx + ix and lx + lw - ix round separately, so at third resolution they can still cross by an ulp and f64::clamp panics; a NaN layer size panicked too. max/min equals clamp whenever the bounds are ordered and cannot panic. The test now covers half and third resolution at fractional offsets and a NaN layer size. The parity note says Amount, not the displacement, is bounded to 2^24 px. --- crates/effects/src/distort2.rs | 19 ++++++++++++------- docs/effects-parity.md | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/crates/effects/src/distort2.rs b/crates/effects/src/distort2.rs index 8ca2f2d72..24ffa3ab6 100644 --- a/crates/effects/src/distort2.rs +++ b/crates/effects/src/distort2.rs @@ -124,7 +124,8 @@ fn turbulent_displace(ctx: &EffectCtx, mut b: Buf) -> Buf { let (lx, ly, lw, lh) = layer_rect(ctx, &b); let edge = (lw.min(lh) * if locked { 0.25 } else { 0.1 }).max(1.0); // Locked: samples stay between the outermost pixel centres, or at the centre of a layer under - // a pixel across (half resolution), whose bounds would otherwise cross. + // a pixel across (a reduced resolution). Its bounds may still differ by rounding, so the + // clamp is max/min, which `f64::clamp` would panic on. let (ix, iy) = (0.5f64.min(lw * 0.5), 0.5f64.min(lh * 0.5)); let lock = (lx + ix, lx + lw - ix, ly + iy, ly + lh - iy); let seed = (ctx.seed ^ 0x7d15).wrapping_add((ctx.params.f("evolutionOptions/randomSeed") as i64 as u32).wrapping_mul(0x9e37_79b9)); @@ -173,7 +174,7 @@ fn turbulent_displace(ctx: &EffectCtx, mut b: Buf) -> Buf { }; let (sx, sy) = (x + dx * k, y + dy * k); if locked { - return Some((sx.clamp(lock.0, lock.1), sy.clamp(lock.2, lock.3))); + return Some((sx.max(lock.0).min(lock.1), sy.max(lock.2).min(lock.3))); } Some((sx, sy)) }); @@ -1077,8 +1078,9 @@ mod tests { } } - /// #3469: a locked pinning on a layer under a buffer pixel across (a 1-pixel layer at half - /// resolution) keeps samples inside it without inverted clamp bounds, at any Amount. + /// #3469: a locked pinning on a layer under a buffer pixel across (a 1-pixel layer at half or + /// third resolution, anywhere in the buffer) keeps samples inside it without its rounded + /// bounds crossing, at any Amount. #[test] fn turbulent_displace_locked_pinning_on_a_subpixel_layer_does_not_crash() { let spec = crate::find("ec.distort.turbulentdisplace").unwrap(); @@ -1086,9 +1088,12 @@ mod tests { let mut params = Params { values: spec.params.iter().map(|p| (p.id.to_string(), p.default.clone())).collect() }; params.values.insert("amount".into(), num(amount)); params.values.insert("pinning".into(), Value::Enum(8)); - let ctx = EffectCtx { params: ¶ms, time: 0.5, layer_size: [1.0, 1.0], seed: 3, adjustment: false, env: Default::default() }; - let o = crate::apply(spec, &ctx, Buf { img: test_img(1, 1), offset: [0.0, 0.0], scale: 0.5 }); - assert!(o.img.data.iter().all(|p| p.iter().all(|v| v.is_finite())), "{amount}"); + for (size, scale, offset) in [(1.0, 0.5, 0.0), (1.0, 1.0 / 3.0, -8.0), (1.0, 1.0 / 3.0, 7.0), (0.9, 1.0, -8.0), (f64::NAN, 1.0, 0.0)] { + let ctx = EffectCtx { params: ¶ms, time: 0.5, layer_size: [size, size], seed: 3, adjustment: false, env: Default::default() }; + let o = crate::apply(spec, &ctx, Buf { img: test_img(2, 2), offset: [offset, offset], scale }); + // A layer size that is not a number only has to render without panicking. + assert!(size.is_nan() || o.img.data.iter().all(|p| p.iter().all(|v| v.is_finite())), "{amount} {size} {scale} {offset}"); + } } } diff --git a/docs/effects-parity.md b/docs/effects-parity.md index d109da598..870a1ca49 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 | Turbulent Displace: Amount takes After Effects' recorded valid range, −10000..10000 (default and the −200..200 slider unchanged). Past it (an expression's value) the displacement 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 | 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-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) |