mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-20 09:05:51 +00:00
Merge remote-tracking branch 'upstream/main' into fix/3464-drop-shadow-softness-range
This commit is contained in:
12 files changed
+413
-53
No files matched your search
@@ -596,7 +596,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] = [
|
||||
@@ -612,7 +612,7 @@ fn pointwise(e: &mut Enc, id: &str, ctx: &EffectCtx, b: GBuf) -> Option<GBuf> {
|
||||
(f("opacity") as f32 / 100.0).clamp(0.0, 1.0),
|
||||
(sh * effectcraft_effects::NOISE_CELL * b.scale).max(1.0) as f32,
|
||||
];
|
||||
p.f[3] = [(f("subSettings/subInfluence") as f32 / 100.0).clamp(0.0, 1.0), 1.0 / sub as f32, 0.0, 0.0];
|
||||
p.f[3] = [(f("subSettings/subInfluence") as f32 / 100.0).clamp(0.0, 1.0), 1.0 / sub as f32, effectcraft_effects::OCTAVE_SCALE_MAX, 0.0];
|
||||
}
|
||||
_ => return None,
|
||||
}
|
||||
|
||||
@@ -618,7 +618,8 @@ fn straight(px: vec4<f32>) -> vec3<f32> {
|
||||
// 9 Gradient Ramp f[0] = (sx, sy, ex, ey); f[1] = start colour; f[2] = end colour;
|
||||
// f[3] = (len2, scatter, blend); u[0] = (_, radial, seed)
|
||||
// 10 Fractal Noise f[0] = (contrast, brightness, scale x, frac); f[1] = (ox, oy, sr, cr);
|
||||
// f[2] = (evo, blend, opacity, scale y); f[3] = (sub influence, 1 / sub scaling);
|
||||
// f[2] = (evo, blend, opacity, scale y); f[3] = (sub influence, 1 / sub scaling,
|
||||
// OCTAVE_SCALE_MAX);
|
||||
// u[0] = (_, kind, n_oct, seed); u[1] = (invert, overflow, normal blend)
|
||||
@compute @workgroup_size(16, 16)
|
||||
fn pointwise(@builtin(global_invocation_id) gid: vec3<u32>) {
|
||||
@@ -856,6 +857,7 @@ fn pointwise(@builtin(global_invocation_id) gid: vec3<u32>) {
|
||||
let scale_y = P.f[2].w;
|
||||
let infl = P.f[3].x;
|
||||
let fmul = P.f[3].y;
|
||||
let fmax = P.f[3].z;
|
||||
let frac = P.f[0].w;
|
||||
let ox = P.f[1].x;
|
||||
let oy = P.f[1].y;
|
||||
@@ -888,7 +890,8 @@ fn pointwise(@builtin(global_invocation_id) gid: vec3<u32>) {
|
||||
sum += n * amp * w;
|
||||
norm += amp * w;
|
||||
amp *= infl;
|
||||
f *= fmul;
|
||||
// noise3::next_octave: the frequency stays within OCTAVE_SCALE_MAX (#3486).
|
||||
f = clamp(f * fmul, 1.0 / fmax, fmax);
|
||||
}
|
||||
var val = sum / max(norm, 1e-6);
|
||||
val = (val - 0.5) * contrast + 0.5 + brightness;
|
||||
|
||||
@@ -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))]);
|
||||
|
||||
Reference in new issue
Block a user