mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-21 01:25:33 +00:00
#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.
This commit is contained in:
2 files changed
+21
-2
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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) |
|
||||
|
||||
Reference in new issue
Block a user