#3486: Fractal Noise: Sub Scaling takes After Effects' 10..10000

After Effects records Sub Scaling's valid range as 10..10000 (slider
25..100), but the hard range stopped at 100, so prop.set and the value
editors clamped 200 to 100. The CPU renderer and the GPU pointwise path
also capped the ratio at 1, so a value above 100 rendered as 100 even
once stored.

Widen the hard range for Fractal and Turbulent Noise (they share the
parameter; slider and default unchanged) and take the ratio from one
sub_scaling_ratio (0.1..100) on the CPU and both GPU paths. Above 100
each octave is larger than the last.

Tests: the range and that 200 and 10000 render differently from 100;
finite output at both ends with Complexity 20, Perspective Offset,
Turbulence Factor 10 and a huge offset; CPU/GPU parity at 200 and 10000
on the pointwise and fxn_fractal paths; prop.set, undo/redo and
save/reopen keep 10 and 10000 (engine range table). The .aep range
guard no longer lists the parameter.
This commit is contained in:
arnav-hiwarkar
2026-11-17 16:10:16 +05:30
parent 8f7896b28a
commit ec1294a1d2
7 changed files with 77 additions and 6 deletions
-1
View File
@@ -736,7 +736,6 @@ mod tests {
("ec.time.pixelmotionblur", "shutterAngle", 3481),
("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),
+1 -1
View File
@@ -112,7 +112,7 @@ pub use transition::{GridWipe, place_layer};
// effectcraft-gpu fx_noise.
pub use keying2::{InnerOuterPlan, inner_outer_plan};
pub use noise::remove_grain_level;
pub use noise3::{FractalGpu, NOISE_CELL, OCTAVE_SCALE_MAX, fractal_gpu};
pub use noise3::{FractalGpu, NOISE_CELL, OCTAVE_SCALE_MAX, fractal_gpu, sub_scaling_ratio};
pub use stylize3::{BumpLight, HexTile, bump_layer_id};
pub use textfx::{TextLayer, text_layer};
pub use time_fx::{PixelMotion, TimewarpPlan, TwStep, pmb_plan, posterized_time, time_frames, timewarp_crop, timewarp_plan};
+54 -3
View File
@@ -65,6 +65,12 @@ pub const NOISE_SOFT_LINEAR: u32 = 2;
/// correlation length), not 100 px.
pub const NOISE_CELL: f64 = 2.0 / 3.0;
/// Sub Scaling (percent, After Effects' valid 10..10000) as the size ratio of each octave to the
/// one before it. Above 1 each octave is larger than the last.
pub fn sub_scaling_ratio(percent: f64) -> f64 {
(percent / 100.0).clamp(0.1, 100.0)
}
/// Bound on an octave's frequency and on its Perspective Offset depth (and their inverses).
/// Unbounded, at Sub Scaling 10000 and Complexity 20 they would reach 100^±19, and Perspective
/// Offset or Turbulence Factor multiplying the offset by the depth overflowed to infinity (NaN
@@ -109,7 +115,7 @@ fn params(turbulent: bool) -> Vec<ParamSpec> {
p("transform/perspectiveOffset", "Perspective Offset", Value::Bool(false), ParamUi::Checkbox),
p("complexity", "Complexity", num(6.0), slider(1.0, 20.0, 1.0, 10.0, 1)),
p("subSettings/subInfluence", "Sub Influence (%)", num(70.0), slider(0.0, 100.0, 25.0, 100.0, 1)),
p("subSettings/subScaling", "Sub Scaling", num(56.0), slider(10.0, 100.0, 25.0, 100.0, 1)),
p("subSettings/subScaling", "Sub Scaling", num(56.0), slider(10.0, 10000.0, 25.0, 100.0, 1)),
];
if !turbulent {
v.extend([
@@ -217,7 +223,8 @@ pub(crate) struct Fractal {
pub perspective: bool,
pub octaves: f32,
pub influence: f32,
/// Sub Scaling as a fraction (each layer is this much smaller).
/// Sub Scaling as a size ratio ([`sub_scaling_ratio`]: each octave is this much the size of the
/// one before).
pub sub_scaling: f32,
pub sub_rotation: f32,
/// Sub Offset in pixels.
@@ -269,7 +276,7 @@ impl Fractal {
perspective: pr.b("transform/perspectiveOffset"),
octaves: pr.f("complexity").clamp(1.0, 20.0) as f32,
influence: (pr.f("subSettings/subInfluence") as f32 / 100.0).clamp(0.0, 1.0),
sub_scaling: (pr.f("subSettings/subScaling") as f32 / 100.0).clamp(0.1, 1.0),
sub_scaling: sub_scaling_ratio(pr.f("subSettings/subScaling")) as f32,
sub_rotation: (pr.f("subSettings/subRotation") as f32).to_radians(),
sub_offset: [(so[0] * b.scale) as f32, (so[1] * b.scale) as f32],
center_subscale: pr.b("subSettings/centerSubscale"),
@@ -709,6 +716,50 @@ mod tests {
assert_ne!(t0, t1);
}
/// #3486: Sub Scaling takes After Effects' 10..10000 for both effects (the slider still shows
/// 25..100), and the renderer uses values above 100 instead of capping them there.
#[test]
fn sub_scaling_takes_the_after_effects_range() {
for id in ["ec.noise.fractal", "ec.noise.turbulent"] {
let ui = &crate::find(id).unwrap().params.iter().find(|p| p.id == "subSettings/subScaling").unwrap().ui;
assert!(
matches!(ui, ParamUi::Slider { min, max, slider_min, slider_max, .. }
if *min == 10.0 && *max == 10000.0 && *slider_min == 25.0 && *slider_max == 100.0),
"{id}: {ui:?}"
);
let at = |v: f64| run(id, &[("subSettings/subScaling", num(v))]);
assert_ne!(at(100.0), at(200.0), "{id}: 200 renders as 100");
assert_ne!(at(200.0), at(10000.0), "{id}: 10000 renders as 200");
}
}
/// #3486: above 100 %, each octave is larger than the last, so its scale grows as Sub
/// Scaling^octave (100^19 at Complexity 20). Perspective Offset and Turbulence Factor multiply
/// the offset by that, which overflowed to infinity and drew NaN, also for a huge offset. At
/// 10 % the lattice coordinates pass the i32 range, whose neighbour index overflowed.
#[test]
fn extreme_sub_scaling_stays_finite() {
for id in ["ec.noise.fractal", "ec.noise.turbulent"] {
for sub in [10.0, 100.0, 9999.0, 10000.0] {
for (perspective, offset) in [(false, [-3000.0, 2500.0]), (true, [-3000.0, 2500.0]), (true, [1e17, -1e17])] {
let mut vals = vec![
("subSettings/subScaling", num(sub)),
("complexity", num(20.0)),
("transform/perspectiveOffset", Value::Bool(perspective)),
("transform/offset", Value::Vec2(offset)),
("evolution", num(200.0)),
("blendingMode", Value::Enum(BLEND_NONE)),
];
if id == "ec.noise.turbulent" {
vals.push(("evolutionOptions/turbulenceFactor", num(10.0)));
}
let img = run(id, &vals);
assert!(img.data.iter().flatten().all(|c| c.is_finite()), "{id} sub {sub} perspective {perspective} offset {offset:?}: non-finite output");
}
}
}
}
/// Turbulent Basic Fractal Noise drawn alone at `w` × `h`.
fn turbulent_basic(w: u32, h: u32, vals: &[(&str, Value)]) -> Image {
let mut all = vec![("fractalType", Value::Enum(2)), ("blendingMode", Value::Enum(BLEND_NONE))];
+2
View File
@@ -60,6 +60,8 @@ 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),
(3486, "ec.noise.fractal", "subSettings/subScaling", 10.0, 10000.0),
(3486, "ec.noise.turbulent", "subSettings/subScaling", 10.0, 10000.0),
];
fn path(effect: &str, param: &str) -> String {
+1 -1
View File
@@ -592,7 +592,7 @@ fn pointwise(e: &mut Enc, id: &str, ctx: &EffectCtx, b: GBuf) -> Option<GBuf> {
let (ox, oy) = b.to_px(pr.v2("transform/offset"));
let s = f("transform/scale");
let (sw, sh) = if pr.b("transform/uniformScaling") { (s, s) } else { (f("transform/scaleWidth"), f("transform/scaleHeight")) };
let sub = (f("subSettings/subScaling") / 100.0).clamp(0.1, 1.0);
let sub = effectcraft_effects::sub_scaling_ratio(f("subSettings/subScaling"));
p.u[0] = [10, kind, octaves.ceil() as u32, f("evolutionOptions/seed") as u32 ^ 0x51ed];
p.u[1] = [pr.b("invert") as u32, pr.e("overflow"), mode, 0];
p.f[0] = [
+18
View File
@@ -136,6 +136,24 @@ fn turbulent_noise() {
effect_case("ec.noise.turbulent", &[("fractalType", e(7)), ("noiseType", e(0)), ("transform/perspectiveOffset", on()), ("opacity", n(70.0))]);
}
/// #3486: Sub Scaling above 100 % on both GPU paths (the `pointwise` kernel for the plain
/// settings, `fxn_fractal` for Perspective Offset and Turbulent Noise), up to After Effects'
/// 10000 at the highest Complexity.
#[test]
fn fractal_noise_sub_scaling_above_100() {
for sub in [200.0, 10000.0] {
effect_case("ec.noise.fractal", &[("subSettings/subScaling", n(sub)), ("complexity", n(20.0))]);
effect_case(
"ec.noise.fractal",
&[("subSettings/subScaling", n(sub)), ("complexity", n(20.0)), ("transform/perspectiveOffset", on()), ("evolution", n(90.0))],
);
effect_case(
"ec.noise.turbulent",
&[("subSettings/subScaling", n(sub)), ("complexity", n(20.0)), ("evolution", n(120.0)), ("evolutionOptions/turbulenceFactor", n(10.0))],
);
}
}
#[test]
fn fractal_noise_other_modes() {
effect_case("ec.noise.fractal", &[("noiseType", e(3)), ("fractalType", e(4)), ("blendingMode", e(3))]);
+1
View File
@@ -64,6 +64,7 @@ the GPU is performance, not parity.
| Date | Change | Summary |
|---|---|---|
| 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-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) |