mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-30 13:08:07 -06:00
Merge pull request #2535 from klosixgaming-arch/fix/943-turbulent-displace-evolution
effects: Turbulent Displace Evolution moves the pattern at a constant rate (#943)
This commit is contained in:
@@ -238,7 +238,7 @@ fn dst_fbm(u: f32, v: f32, z: f32, seed: u32) -> f32 {
|
||||
if (o + 1u == n && frac > 0.0) {
|
||||
w = frac;
|
||||
}
|
||||
sum += value_noise(u * f, v * f, z + f32(o) * 5.17, seed + o * 101u) * amp * w;
|
||||
sum += value_noise_linear_z(u * f, v * f, z + f32(o) * 5.17, seed + o * 101u) * amp * w;
|
||||
norm += amp * w;
|
||||
amp *= falloff;
|
||||
f *= 2.0;
|
||||
|
||||
@@ -525,12 +525,25 @@ fn fade(t: f32) -> f32 {
|
||||
}
|
||||
|
||||
fn value_noise(x: f32, y: f32, z: f32, seed: u32) -> f32 {
|
||||
return value_noise_z(x, y, z, seed, true);
|
||||
}
|
||||
|
||||
// effects::generate::value_noise_linear_z: z (evolution) interpolates linearly, x and y keep the
|
||||
// quintic fade (Turbulent Displace, #943).
|
||||
fn value_noise_linear_z(x: f32, y: f32, z: f32, seed: u32) -> f32 {
|
||||
return value_noise_z(x, y, z, seed, false);
|
||||
}
|
||||
|
||||
fn value_noise_z(x: f32, y: f32, z: f32, seed: u32, ease_z: bool) -> f32 {
|
||||
let x0 = floor(x);
|
||||
let y0 = floor(y);
|
||||
let z0 = floor(z);
|
||||
let fx = fade(x - x0);
|
||||
let fy = fade(y - y0);
|
||||
let fz = fade(z - z0);
|
||||
var fz = z - z0;
|
||||
if (ease_z) {
|
||||
fz = fade(fz);
|
||||
}
|
||||
let ix = i32(x0);
|
||||
let iy = i32(y0);
|
||||
let iz = i32(z0);
|
||||
|
||||
@@ -55,6 +55,11 @@ fn turbulent_displace_and_cc_lens() {
|
||||
],
|
||||
);
|
||||
effect_case("ec.distort.turbulentdisplace", &[("displacement", e(8)), ("size", n(15.0)), ("pinning", e(6))]);
|
||||
// #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] {
|
||||
effect_case("ec.distort.turbulentdisplace", &[("evolution", n(evolution)), ("size", n(12.0)), ("amount", n(30.0))]);
|
||||
}
|
||||
effect_case("ec.distort.cclens", &[("size", n(70.0))]);
|
||||
effect_case("ec.distort.cclens", &[("size", n(45.0)), ("convergence", n(60.0)), ("center", Value::Vec2([30.0, 20.0]))]);
|
||||
effect_case("ec.distort.cclens", &[("convergence", n(-70.0))]);
|
||||
|
||||
Reference in New Issue
Block a user