EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
Merge upstream/main into rfx-blur-stylize
vangel7631c624f4787b
diff --cc crates/effects/src/lib.rsindex 561a41cbe,cc0aad515..204e651ec--- a/crates/effects/src/lib.rs+++ b/crates/effects/src/lib.rs@@@ -70,14 -71,14 +71,14 @@@ use std::collections::HashMapuse std::sync::OnceLock;pub use card3d::{CompLight, CompScene};- pub use color_fx::{COLORAMA_PRESETS, ColoramaPalette};pub use color_fx::{- HUESAT_CHANNELS, HUESAT_RANGES, LEVELS_CHANNELS, PHOTO_FILTER_CUSTOM, PHOTO_FILTERS, exposure_settings, fill_uses_masks, huesat_ranges_identity,- levels_channel_ids, levels_channel_settings, levels_channels_identity, levels_clip,+ BW_TINT_LUMA, EXPOSURE_LINEAR_GAMMA, HUESAT_CHANNELS, HUESAT_RANGES, LEVELS_CHANNELS, LUMA_601, PHOTO_FILTER_CUSTOM, PHOTO_FILTERS, exposure_settings,+ fill_uses_masks, huesat_ranges_identity, levels_channel_ids, levels_channel_settings, levels_channels_identity, levels_clip,};+ pub use color_fx::{COLORAMA_PRESETS, ColoramaPalette};pub use color2::{Curve, auto_correct_settings, color_link_mode, color_link_sample, equalize_tables, luma_clip_points, shadow_highlight_amounts};pub use color3::OffsetCurve;-pub use distort::transform_shutter;+pub use distort::{transform_grow, transform_matrix_px, transform_shutter};pub use distort2::{MAGNIFY_MODES, bezier_grid, parse_mesh};pub use distort3::{RESHAPE_POINTS, ReshapeSetup, SmearSetup, cc_smear_pad, reshape_setup, smear_setup, warp_inverse_map};pub use distort4::liquify_mesh;diff --cc crates/gpu/src/tests.rsindex e7a68e7bc,b2e1113e2..347696313--- a/crates/gpu/src/tests.rs+++ b/crates/gpu/src/tests.rs@@@ -851,16 -899,52 +899,62 @@@ fn effects_whose_kernels_failed_render_}}+/// WGSL cannot read the CPU's constants, so Glow's bright pass repeats them as literals; this+/// ties them to `effects::GLOW_GAIN` / `GLOW_KNEE` (runs without a GPU).+#[test]+fn glow_constants_match_the_cpu() {+ use effectcraft_effects::{GLOW_GAIN, GLOW_KNEE};+ let kernels = include_str!("shaders/kernels.wgsl");+ let want = format!("max({GLOW_GAIN:?} * (px.xyz / a - vec3<f32>(thr - {GLOW_KNEE:?})), vec3<f32>(0.0))");+ assert!(kernels.contains(&want), "Glow's bright pass in kernels.wgsl is not `{want}`");+}++ /// The GPU Tint gives After Effects 2026's greys for full-frame solids at its defaults (sRGB+ /// working space, not linearised): Rec. 601 weights, as the CPU (`color_fx::luma_601`).+ #[test]+ fn gpu_tint_defaults_match_after_effects_greys() {+ let Some(g) = gpu() else {+ // Visible skip (EFFECTCRAFT_REQUIRE_GPU=1 makes a missing adapter fail instead).+ eprintln!("gpu_tint_defaults_match_after_effects_greys: skipped: no GPU adapter");+ return;+ };+ for (col, want) in [([1.0, 0.0, 0.0], 76.0), ([0.0, 1.0, 0.0], 150.0), ([0.0, 0.0, 1.0], 29.0), ([0.5, 0.5, 0.5], 128.0)] {+ let mut s = Scene::new(BitDepth::Bpc32);+ s.p.settings.working_space = Some(ColorSpace::Srgb);+ let mut l = s.solid(col, 97, 61);+ s.effect(&mut l, "ec.color.tint", &[]);+ s.push(l);+ let mut r = Renderer::new(&s.p, &Pattern, RenderOpts { backend: Backend::Gpu, ..opts() });+ r.accel = Some(g);+ let o = g.render(&r, s.cid, Tick::ZERO).expect("the GPU renders the frame").get(48, 30);+ let want = want / 255.0;+ assert!(o[..3].iter().all(|v| (v - want).abs() <= 1.0 / 255.0), "{col:?}: {o:?} vs {want}");+ }+ }++ /// WGSL has no way to read the CPU's constants, so the kernels repeat them as literals; this+ /// ties each literal to its Rust source (runs without a GPU): Rec. 601 luma for Tint (`pointwise`+ /// op 1), Tritone and Luma Key / Extract, Black & White's tint weights and Exposure's 2.2 power.+ #[test]+ fn shader_constants_match_the_cpu() {+ use effectcraft_effects::{BW_TINT_LUMA, EXPOSURE_LINEAR_GAMMA, LUMA_601};+ let kernels = include_str!("shaders/kernels.wgsl");+ let color = include_str!("shaders/fx_color.wgsl");+ let key = include_str!("shaders/fx_key.wgsl");+ let [r, g, b] = LUMA_601;+ let dot = format!("dot(c, vec3<f32>({r}, {g}, {b}))");+ assert!(kernels.contains(&format!("clamp({r} * c.x + {g} * c.y + {b} * c.z, 0.0, 1.0)")), "Tint luma in kernels.wgsl is not {LUMA_601:?}");+ assert!(color.contains(&format!("clamp({dot}, 0.0, 1.0)")), "Tritone luma in fx_color.wgsl is not {LUMA_601:?}");+ assert!(key.contains(&format!("return {dot};")), "fxk_key_luma in fx_key.wgsl is not {LUMA_601:?}");+ let [r, g, b] = BW_TINT_LUMA;+ assert!(color.contains(&format!("let w = vec3<f32>({r}, {g}, {b});")), "fxc_bw_tint weights are not {BW_TINT_LUMA:?}");+ let gamma = EXPOSURE_LINEAR_GAMMA;+ assert!(+ kernels.contains(&format!("powz(abs(c[i]), {gamma})")) && kernels.contains(&format!("1.0 / {gamma})")),+ "Exposure's power in kernels.wgsl is not {gamma}"+ );+ }+/// A layer whose bounds change every frame reads back at a new size each time: the staging/// buffers kept for reuse stay within budget instead of growing for the whole render (#2081).#[test]diff --cc docs/effects-parity.mdindex 2f97c8e56,6defcba8e..83e9a15bc--- a/docs/effects-parity.md+++ b/docs/effects-parity.md@@@ -15,7 -15,7 +15,7 @@@ After Effects', and does the preset lib| Parameter names, order, popups, units, defaults | aligned in M9.12 | Agent-checked against After Effects' documentation, not against a live dump || On the GPU | **280** (92%) | Measured: registry flags; GPU vs CPU agreement tested per effect || 32-bit float, no clamping | 306 | Measured: registry flags |- | **Rendered output matches After Effects** | **partly measured** | Radial Blur, Glow, Venetian Blinds, Radial Wipe, Fractal / Turbulent Noise and Transform are checked against After Effects 2026 renders of our own test projects (rows below); every other effect is unmeasured. `effectcraft_effects::fidelity::compare_frames` exists for the corpus ([fidelity/README.md](fidelity/README.md)); simulation effects are pinned by golden hashes of our own output (M13.27) |-| **Rendered output matches After Effects** | **partly measured** | Some colour effects are checked against After Effects 2026 renders of our own test projects: Tint, Tritone, Black & White, Exposure, Levels, Curves, Luma Key, Extract, 4-Color Gradient and Fill within 1–3/255, Brightness & Contrast up to 6.2/255 (Color Correction, Generate and Keying rows below); every other effect is unmeasured. `effectcraft_effects::fidelity::compare_frames` exists for the corpus ([fidelity/README.md](fidelity/README.md)); simulation effects are pinned by golden hashes of our own output (M13.27) |++| **Rendered output matches After Effects** | **partly measured** | Some colour effects are checked against After Effects 2026 renders of our own test projects: Tint, Tritone, Black & White, Exposure, Levels, Curves, Luma Key, Extract, 4-Color Gradient and Fill within 1–3/255, Brightness & Contrast up to 6.2/255 (Color Correction, Generate and Keying rows below); Radial Blur, Glow, Venetian Blinds, Radial Wipe, Fractal / Turbulent Noise and Transform are checked the same way (rows below); every other effect is unmeasured. `effectcraft_effects::fidelity::compare_frames` exists for the corpus ([fidelity/README.md](fidelity/README.md)); simulation effects are pinned by golden hashes of our own output (M13.27) || Animation presets | **54** original presets (8 text-animator, 23 Transitions, 23 Backgrounds) against After Effects' **621** `.ffx` presets | Measured: `crates/engine/presets/text_animators.json`, `crates/engine/presets/transitions.json`, `crates/engine/presets/backgrounds.json`; the After Effects `Presets` folder || 26.x additions | Curl Noise (26.3) present (#463 open); effect colour labels (26.5) present in Effect Controls only, not in the Timeline; the rebuilt Effect Controls (26.5) missing | Release notes |@@@ -28,17 -28,17 +28,17 @@@ corpus compares renders, each effect i|---|---:|---:|---|| 3D Channel | 8 | 8 | Cryptomatte selection can't be set in the UI and the GPU path is slow (#473; quoted names with commas fixed); multi-layer EXR decode shared (#474 open: f16 storage and cache sizing remain) || Audio | 13 | 0 | CPU by design (applied in the mixdown) |-| Blur & Sharpen | 16 | 15 | Gaussian Blur interaction and output to be measured first ([fidelity/ae-2026-acceptance.md](fidelity/ae-2026-acceptance.md)) |+| Blur & Sharpen | 16 | 15 | Radial Blur keeps the layer edges as After Effects 2026 (713 now pixel-identical); Gaussian Blur interaction and output to be measured first ([fidelity/ae-2026-acceptance.md](fidelity/ae-2026-acceptance.md)) || Channel | 13 | 13 | — |- | Color Correction | 40 | 40 | Tint has Swap Colors (#963); ACES 2.0 / OCIO 2.5 (26.5); Apply Color LUT (#514) and 32-bpc blending (#494) are closed |+ | Color Correction | 40 | 40 | Tint, Tritone and Black & White (sliders and Tint) match After Effects 2026 renders (Rec. 601 luminance); Levels (Individual Controls) matches After Effects 2026 in 32 bpc (channel controls before RGB, "Off for 32 bpc Color" unclipped; plain Levels' channel order not measured); Brightness & Contrast (non-legacy) close to After Effects 2026 ramps, not identical (up to 6.2/255 off; the test allows 7/255) (negative settings invert the positive curves); Curves interpolates a natural cubic spline through its points, as After Effects 2026 (exact on its grey steps); Tint has Swap Colors (#963); ACES 2.0 / OCIO 2.5 (26.5); Apply Color LUT (#514) and 32-bpc blending (#494) are closed |-| Distort | 39 | 35 | Liquify has no viewer brush; #303 (Mesh Warp drag) and #534 (CC Power Pin Unstretch) are closed |+| Distort | 39 | 35 | Transform matches After Effects 2026 renders (skew after rotation, drawn outside the layer); Liquify has no viewer brush; #303 (Mesh Warp drag) and #534 (CC Power Pin Unstretch) are closed || Expression Controls | 9 | 9 | — |- | Generate | 26 | 25 | Fractal on the CPU (needs f64); #526 (Reset) and #536 (Write-on marks) are closed |+ | Generate | 26 | 25 | 4-Color Gradient's Blend matches After Effects 2026 (weights 1 / (d² + Blend²)); Fill's Opacity is the filled layer's opacity, as After Effects 2026 renders it (with a Fill Mask it still mixes with the original, not measured); Fractal on the CPU (needs f64); #526 (Reset) and #536 (Write-on marks) are closed || Immersive Video | 12 | 12 | — |- | Keying | 12 | 12 | Key Cleaner approximated; #533 (wire-removal Frame Offset) is closed |+ | Keying | 12 | 12 | Luma Key and Extract key on Rec. 601 luminance, as After Effects 2026; Key Cleaner approximated; #533 (wire-removal Frame Offset) is closed || Matte | 6 | 4 | Mocha shape reads our documented JSON, not Mocha's format |-| Noise & Grain | 13 | 12 | Curl Noise (#463); Match Grain on the CPU |+| Noise & Grain | 13 | 12 | Fractal / Turbulent Noise lattice matches After Effects 2026 (Scale 100 = 66.7 px cells); the noise values themselves differ (seeds) and Soft Linear contrast is about 20 % lower than AE's; Curl Noise (#463); Match Grain on the CPU |- | Obsolete | 9 | 9 | — |+ | Obsolete | 9 | 9 | Luma Key matches After Effects 2026 on a grey ramp (hard cut, Tolerance only for Similar / Dissimilar) || Paint | 1 | 0 | Tablet pressure not read ([hardware-parity.md](hardware-parity.md)) || Perspective | 10 | 9 | Chromatic Aberrations pan/tilt crash (#580) || Simulation | 18 | 18 | Particle Playground lacks Particle Exploder, text particles, ephemeral mapper; CC Particle World camera fixed (#397) |@@@ -64,13 -64,17 +64,24 @@@ the GPU is performance, not parity| Date | Change | Summary ||---|---|---|+| 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) |+| 2026-10-19 | minor | Radial Blur repeats the edge instead of sampling transparency outside the layer, measured against After Effects 2026 renders (CPU; Radial Blur has no GPU path) |+| 2026-10-19 | minor | Venetian Blinds: stripes measured from the layer centre, both band edges Gaussian (σ = Feather / 2), measured against After Effects 2026 (CPU and GPU) |+| 2026-10-19 | minor | Radial Wipe: Feather is in pixels on both edges of the wiped wedge (was degrees on the moving edge only), measured against After Effects 2026 (CPU and GPU) |+| 2026-10-19 | minor | Fractal / Turbulent Noise: lattice cell = Scale × 2/3 px (Block noise every 66.7 px at Scale 100, as After Effects 2026), CPU and GPU |+| 2026-10-19 | minor | Transform: After Effects' skew order and output beyond the layer bounds, measured against After Effects 2026 renders of three cases (CPU and GPU) |+ | 2026-10-19 | minor | Tritone uses Rec. 601 luminance, measured against After Effects 2026 renders of a red solid and a grey ramp (CPU and GPU) |+ | 2026-10-19 | minor | Black & White's Tint keeps the gray's luminosity (Color blend), measured against After Effects 2026 renders (CPU and GPU) |+ | 2026-10-19 | minor | Levels: "Off for 32 bpc Color" no longer clips in 32 bpc projects, unclipped values extrapolate below Output Black; Levels (Individual Controls) applies the channel controls before the RGB ones, measured against After Effects 2026 (CPU and GPU) |+ | 2026-10-19 | minor | Brightness & Contrast: negative Brightness / Contrast are the inverse curves of the positive ones (Brightness −40: 20/255 → 6/255 off After Effects 2026; still up to 6.2/255 off, not the same pixels), CPU and GPU |+ | 2026-10-19 | minor | Luma Key: Key Out Brighter / Darker cut hard at Threshold, measured against After Effects 2026 renders of a ramp (CPU and GPU) |+ | 2026-10-19 | minor | Luma Key and Extract: Rec. 601 luminance (was Rec. 709), measured against After Effects 2026 (CPU and GPU) |+ | 2026-10-19 | minor | 4-Color Gradient: each point weighs 1 / (d² + Blend²), measured against After Effects 2026 at Blend 10 / 50 / 100 / 300 (CPU and GPU) |+ | 2026-10-19 | minor | Fill without a mask: the layer becomes the fill colour at its alpha × Opacity (was a mix with the original), measured against After Effects 2026 (CPU and GPU) |+ | 2026-10-19 | minor | Curves: natural cubic spline through the points, clamped to 0..1 (was a monotone spline), measured against After Effects 2026 (CPU and GPU); Lumetri's curves and Glow's Arbitrary Map keep the monotone spline |+ | 2026-10-18 | minor | Tint uses Rec. 601 luminance weights, measured against After Effects 2026 renders of red, green, blue and grey solids (CPU and GPU) |+ | 2026-10-18 | minor | Exposure converts to linear light with a pure 2.2 power curve, as measured in After Effects (Offset 0.0005 / 0.002 / 0.02 / 0.1 on black: 8 / 15 / 43 / 90), not the piecewise sRGB curve; its sliders take After Effects' ranges (Exposure −100..100, slider −4..4; Offset −2..2, slider −0.5..0.5; Gamma Correction 0.1..10) || 2026-10-12 | minor | Parameters 3,014 to 3,017 (effects.md); #303, #514, #526, #533–#536 marked closed instead of pending || 2026-10-12 | minor | Effect colour labels (26.5) added in Effect Controls || 2026-10-12 | minor | Tint's Swap Colors button and agent-drivable command (#963); undo/redo, instance targeting, animated layer-time edits and invalid-input tests |