Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Fix tests after the community merges: GPU Pixel Motion Blur without a host, timeline footage kind, effects doc

Brandon Thomas0b2d85b81118
diff --git a/crates/engine/src/tests_timeline.rs b/crates/engine/src/tests_timeline.rs
index bbd9e4535..0af232b1c 100644
--- a/crates/engine/src/tests_timeline.rs
+++ b/crates/engine/src/tests_timeline.rs
@@ -973,6 +973,7 @@ fn add_item_keeps_footage_longer_than_the_comp_at_full_length() {
let f = effectcraft_project::Footage {
width: 100,
height: 100,
+ kind: effectcraft_project::FootageKind::Video,
has_video: true,
duration: effectcraft_time::Tick::from_seconds_f64(10.0),
..Default::default()
diff --git a/crates/gpu/src/fx_time.rs b/crates/gpu/src/fx_time.rs
index e7fd628a0..71f7a5821 100644
--- a/crates/gpu/src/fx_time.rs
+++ b/crates/gpu/src/fx_time.rs
@@ -45,11 +45,17 @@ pub(crate) fn apply(e: &mut Enc, id: &str, ctx: &EffectCtx, b: GBuf) -> Option<G
let fd = 1.0 / ctx.fps();
mean_of(e, ctx, b, &(-back..=fwd).map(|k| ctx.time + k as f64 * fd).collect::<Vec<_>>())
}
- // Pixel Motion Blur synthesizes along measured motion vectors (#535); a plan that
- // cannot be built (no host) declines to the CPU effect.
+ // Pixel Motion Blur synthesizes along measured motion vectors (#535); without a plan (no
+ // host to read neighbouring frames) it averages the shutter's frames, as the CPU effect does.
"ec.time.pixelmotionblur" => match effectcraft_effects::pmb_plan(ctx) {
Some(plan) => render_plan(e, &plan),
- None => None,
+ None => {
+ let angle = if ctx.params.e("shutterControl") == 1 { ctx.params.f("shutterAngle") } else { 180.0 };
+ let n = ctx.params.f("shutterSamples").round().clamp(1.0, 64.0) as usize;
+ let span = angle.clamp(0.0, 720.0) / 360.0 / ctx.fps();
+ let times: Vec<f64> = (0..n).map(|i| ctx.time - span * 0.5 + if n > 1 { span * i as f64 / (n - 1) as f64 } else { span * 0.5 }).collect();
+ mean_of(e, ctx, b, &times)
+ }
},
"ec.time.timewarp" => timewarp(e, ctx, b),
_ => None,
diff --git a/docs/effects.md b/docs/effects.md
index 0fac41ed9..7b8f479e1 100644
--- a/docs/effects.md
+++ b/docs/effects.md
@@ -3,7 +3,7 @@
<!-- Generated from the effect registry (crates/effects/src/catalog.rs); do not edit by hand.
Regenerate: UPDATE_DOCS=1 cargo test -p effectcraft-effects --lib effects_doc_is_current -->
-EffectCraft ships 306 effects with 3014 parameters in total, grouped into the same categories as the Effects & Presets panel. Every effect is our own implementation, written from public behaviour descriptions and standard image-processing literature. Parameter names, order, popup options, units, defaults and ranges follow the reference application so that projects, expressions and muscle memory carry over.
+EffectCraft ships 306 effects with 3017 parameters in total, grouped into the same categories as the Effects & Presets panel. Every effect is our own implementation, written from public behaviour descriptions and standard image-processing literature. Parameter names, order, popup options, units, defaults and ranges follow the reference application so that projects, expressions and muscle memory carry over.
- **GPU**: 280 effects also run on the GPU compositor with identical results.
- **32**: 306 effects process 32-bit float (HDR, overbright) pixels without clamping.