From 3a881cf0f7794aa1acc31bd121ba60eba3e95b0a Mon Sep 17 00:00:00 2001 From: clover caruso Date: Mon, 30 Nov 2026 16:12:55 -0800 Subject: [PATCH] Implement Paint, PaintMask, PolylineStroke, Multistroke, and Dimension.CopyAux (#24) Strokes are CPU-rasterized into one RGBA layer that is composited with the Merge shader (Paint) or post-processed through the shared mask path (PaintMask). Dimension.CopyAux passes RGBA through; the engine carries no aux planes. Assisted-by: claude-sonnet-5.5 --- compatibility.md | 21 +- crates/engine/src/eval/masks.rs | 144 +++++---- crates/engine/src/eval/mod.rs | 14 +- crates/engine/src/eval/paint.rs | 509 ++++++++++++++++++++++++++++++++ crates/model/src/comp.rs | 5 + scripts/gen_compatibility.py | 6 +- 6 files changed, 629 insertions(+), 70 deletions(-) create mode 100644 crates/engine/src/eval/paint.rs diff --git a/compatibility.md b/compatibility.md index 6d4846db71904a92072615f73ca4175c86355c41..bad70ad3e0c5ece2cd338a71f91a292c1fdc7c2c 100644 --- a/compatibility.md +++ b/compatibility.md @@ -9,10 +9,10 @@ Auto-generated from live engine sources (`crates/engine/src/eval.rs`, `crates/en | Metric | Value | | --- | --- | -| **Supported Flow Tools** | **110** (85 2D/Fuse/utility in `eval.rs`, 23 3D scene nodes in `scene3d.rs`, 2 Flow annotations) | +| **Supported Flow Tools** | **115** (90 2D/Fuse/utility in `eval.rs`, 23 3D scene nodes in `scene3d.rs`, 2 Flow annotations) | | **Modifiers & Animation** | **8** systems (9 Fusion modifier classes + Lua expressions) | -| **Active Corpus (`trees/fusion`) Coverage** | **99.5%** (1,984 / 1,993 nodes across 16 `.comp` files) | -| **Archive Corpus (`private/samples`) Coverage** | **99.4%** (54,635 / 54,955 nodes across 324 `.comp` files) | +| **Active Corpus (`trees/fusion`) Coverage** | **99.7%** (1,988 / 1,993 nodes across 16 `.comp` files) | +| **Archive Corpus (`private/samples`) Coverage** | **99.6%** (54,734 / 54,955 nodes across 324 `.comp` files) | | **HiQ vs Fast Mode** | **`HiQ`**: honors `DepthFull` / generator `Depth` / `ChangeDepth` (`Rgba8Unorm`, clamped `Rgba16Float`, unclamped HDR `Rgba16Float`/`Rgba32Float`), full-res blurs & `XGlow`. **`Fast`**: collapses working targets to `Rgba8Unorm`, downsamples blurs, caps `XGlow` octaves for interactive scrubbing. | ## Generators @@ -31,6 +31,9 @@ Auto-generated from live engine sources (`crates/engine/src/eval.rs`, `crates/en | --- | --- | --- | --- | --- | | `Merge` | `merge` | 0.0%–0.3% | 293 / 6358 | All ApplyModes (`Normal`, `Screen`, `Multiply`, `Difference`, `DarkerColor`, `Overlay`, `Hard/Soft/Linear/VividLight`, `LinearDodge`, etc.), `Operator=Over/Under`, `Gain`, `BurnIn`, `SubtractiveAdditive`, `Blend`, effect mask. | | `Dissolve` | `tier1_b` | 0.0%–0.1% | 0 / 4 | Mix (`Mix = 0..1`) between `Background` and `Foreground` with effect mask support. | +| `Paint` | Unit tests | Visual* | 0 / 25 | Composites the `Paint` stroke chain (`PolylineStroke` / `Multistroke`) over `Input` with `Blend` and `EffectMask`. CPU-rasterized round `CircleBrush` / `SoftBrush` (`Size`, `Softness`), `PaintApplyColor` (`Red`/`Green`/`Blue`/`Opacity`) and `PaintApplyErase` (erases earlier strokes). *Brush size/softness falloff are not Fusion-calibrated; `Clone` and other apply modes are skipped. | +| `PolylineStroke` | Unit tests | Visual* | 0 / 27 | Bezier/linear `Polyline` (static or animated) with `WriteOnStart`/`WriteOnEnd`; always visible. Rendered only through `Paint` / `PaintMask`. | +| `Multistroke` | Unit tests | Visual* | 0 / 33 | Recorded freehand `Strokes`, visible from `Time` for `Duration` frames (default 1) with per-stroke `Params` overrides (`ApplyMode`, `Size`, `Softness`, color, `Duration`). Per-point `T` is ignored. Rendered only through `Paint` / `PaintMask`. | | `Shadow` | `tier1_b` | 0.1%–0.4% | 0 / 38 | Drop shadow offset, softness blur, tint color/alpha, and `ShadowOnly` output. | ## Color & Depth @@ -101,6 +104,7 @@ Auto-generated from live engine sources (`crates/engine/src/eval.rs`, `crates/en | `PolylineMask` | `mask_softedge`, Suite comps | 0.1%–0.4% | 16 / 505 | CPU `zeno` Bezier/linear polygon rasterizer with animated keyframed `Polyline` splines, progressive-pyramid `SoftEdge`, `ClippingMode`, `Invert`, `PaintMode`. | | `BitmapMask` | `mask_softedge` | 0.0%–0.2% | 3 / 121 | GPU image-to-mask extraction (`Alpha`/`Luminance`/`Red`/`Green`/`Blue`/`Saturation`/`Lightness`/`Hue`), `Low`/`High` clip, centered 1:1 alignment, `SoftEdge`, `Invert`, `Level`, `PaintMode`. | | `WandMask` | `archive_3d` | 0.0%–0.3% | 0 / 150 | Seeded BFS flood-fill wand mask (`Source`, `SelectionPoint`, `SelectionRange`, `ColorSpace`, `SoftEdge`, `Invert`, `Level`, `PaintMode`). | +| `PaintMask` | Unit tests | Visual* | 0 / 14 | Alpha mask of the `Paint` stroke chain (stroke opacity, erase), `MaskWidth`/`MaskHeight`, `SoftEdge`, `Filter`, `ClippingMode`, `Invert`, `Level`, `PaintMode` chaining. *Brush falloff is not Fusion-calibrated. | ## 2D Vector Shapes @@ -164,6 +168,7 @@ Auto-generated from live engine sources (`crates/engine/src/eval.rs`, `crates/en | --- | --- | --- | --- | --- | | `Saver` | All suites | 0.0% | 15 / 278 | Output sink / passthrough in interactive Flow; Saver-driven pipelined PNG sequence export (`render-check --export` and `Cmd+Shift+R`). | | `Dimension.OpticalFlow` | Unit tests | 0.1% | 2 / 10 | GPU 4-level pyramid coarse-to-fine bidirectional dense optical flow feeding downstream `TimeStretcher` flow interpolation. | +| `Dimension.CopyAux` | Unit tests | Visual* | 4 / 0 | Passes the RGBA `Input` through unchanged in both `Mode`s. *The engine carries no auxiliary planes (`Z`, `Coverage`, `ObjectID`, `Vector`, ...), so `Channel` is ignored and aux-to-color output is not produced. | | `TimeStretcher` | Suite comps | 0.0%–0.2% | 13 / 82 | Keyframed/expression `SourceTime` remapping with `Nearest` (`0`), `Blend` (`1`), and GPU `OpticalFlow` (`2`) bidirectional warped interpolation. | | `TimeSpeed` | Suite comps | 0.0% | 0 / 166 | Constant/animated `Speed` and `Delay` time remapping. | | `Switch` | Suite comps | 0.0% | 2 / 23 | Dynamic input routing by `Which` index (`Input1`..`InputN`). | @@ -199,16 +204,11 @@ Unlike Blackmagic Fusion — which unlinks missing OFX or Resolve-only plugins w | `SurfaceTracker` | 2 / 1 | [#7](https://shale.paperclover.net/fission/issues/7) | Preserved lossless on save; passes through main image input in Flow. | | `MagicMask` | 3 / 1 | [#7](https://shale.paperclover.net/fission/issues/7) | Preserved lossless on save; passes through main image input in Flow. | | `PlanarTracker` | 0 / 0 | [#7](https://shale.paperclover.net/fission/issues/7) | Preserved lossless on save; passes through main image input in Flow. | -| `Dimension.CopyAux` | 4 / 0 | — | Preserved lossless on save; passes through main image input. | -| `Multistroke` | 0 / 33 | — | Preserved lossless on save; passes through main input in Flow. | -| `PolylineStroke` | 0 / 27 | — | Preserved lossless on save; passes through main input in Flow. | -| `Paint` | 0 / 25 | — | Preserved lossless on save; passes through main input in Flow. | | `Fuse.HexagonTiles` | 0 / 25 | — | Preserved lossless on save; passes through main input in Flow. | | `AudioDisplay` | 0 / 21 | — | Preserved lossless on save; passes through main input in Flow. | | `Fuse.AlphaWeightedNoise` | 0 / 21 | — | Preserved lossless on save; passes through main input in Flow. | | `Fuse.Hexagon` | 0 / 17 | — | Preserved lossless on save; passes through main input in Flow. | | `DaySky` | 0 / 16 | — | Preserved lossless on save; passes through main input in Flow. | -| `PaintMask` | 0 / 14 | — | Preserved lossless on save; passes through main input in Flow. | | `SurfaceAlembicMesh` | 0 / 13 | — | Preserved lossless on save; passes through main input in Flow. | | `PseudoColor` | 0 / 6 | — | Preserved lossless on save; passes through main input in Flow. | | `Fuse.CheckerPieceGenerator` | 0 / 6 | — | Preserved lossless on save; passes through main input in Flow. | @@ -220,6 +220,11 @@ Unlike Blackmagic Fusion — which unlinks missing OFX or Resolve-only plugins w | `sGrid` | 0 / 4 | — | Preserved lossless on save; passes through main input in Flow. | | `DepthBlur` | 0 / 4 | — | Preserved lossless on save; passes through main input in Flow. | | `Replicate3D` | 0 / 4 | — | Preserved lossless on save; passes through main input in Flow. | +| `SphereMap` | 0 / 4 | — | Preserved lossless on save; passes through main input in Flow. | +| `RemoveNoise` | 0 / 3 | — | Preserved lossless on save; passes through main input in Flow. | +| `RankFilter` | 0 / 3 | — | Preserved lossless on save; passes through main input in Flow. | +| `AcesTransform` | 0 / 3 | — | Preserved lossless on save; passes through main input in Flow. | +| `Bender3D` | 0 / 2 | — | Preserved lossless on save; passes through main input in Flow. | --- diff --git a/crates/engine/src/eval/masks.rs b/crates/engine/src/eval/masks.rs index 23d1a24a3adada77fc616e566d7591bc26a9dc9c..a0143ffee94b07ba45f348e1e63bb18fefbd57c7 100644 --- a/crates/engine/src/eval/masks.rs +++ b/crates/engine/src/eval/masks.rs @@ -1,5 +1,16 @@ use super::*; +/// GPU post-processing applied to a CPU-rasterized mask. +pub(super) struct MaskPost<'a> { + pub soft_px: f32, + pub is_box: bool, + pub clamp_edges: f32, + pub paint_mode: f32, + pub invert: bool, + pub level: f32, + pub prev: Option<&'a CachedTexture>, +} + impl Engine { pub(super) fn paint_mode_id(node: &Node) -> f32 { match node.static_str("PaintMode").unwrap_or("Merge") { @@ -178,15 +189,7 @@ impl Engine { visiting: &mut HashSet<(NodeId, i64)>, stats: &mut EvalStats, ) -> CachedTexture { - let has_explicit_w = node.inputs.contains_key("MaskWidth"); - let has_explicit_h = node.inputs.contains_key("MaskHeight"); - let size = if has_explicit_w || has_explicit_h { - let w = comp.eval_number(node, "MaskWidth", time, comp.width as f64, &self.expr) as u32; - let h = comp.eval_number(node, "MaskHeight", time, comp.height as f64, &self.expr) as u32; - if w >= 16 && h >= 16 { self.scaled_dims(w, h) } else { comp_dims } - } else { - self.mask_target_size.unwrap_or(comp_dims) - }; + let size = self.explicit_mask_size(comp, node, time, comp_dims); let center = comp.eval_point(node, "Center", time, [0.5, 0.5], &self.expr); let soft = comp.eval_number(node, "SoftEdge", time, 0.0, &self.expr).max(0.0) as f32; let invert = comp.eval_number(node, "Invert", time, 0.0, &self.expr) > 0.5; @@ -197,27 +200,7 @@ impl Engine { let prev_hash = prev_mask.as_ref().map_or(0, |m| m.content_hash); let paint_mode = Self::paint_mode_id(node); - let evaluated_pts: Vec; - let points: &[model::PolyPoint] = if let Some(src) = node.connected_node("Polyline") { - if let Some(pts) = comp.eval_polyline_spline(src, time) { - evaluated_pts = pts; - &evaluated_pts - } else if let Some(pp) = comp.poly_paths.get(src) { - pp.points.as_slice() - } else { - &[] - } - } else if let Some(pl_tbl) = node - .raw - .get_table("Inputs") - .and_then(|i| i.get_table("Polyline").or_else(|| i.get_table("PolyLine"))) - .and_then(|p| p.get_table("Value")) - { - evaluated_pts = model::PolyPath::parse_polyline_table(pl_tbl).1; - &evaluated_pts - } else { - &[] - }; + let points = Self::polyline_points(comp, node, time); let mut hash_floats = Vec::with_capacity(8 + points.len() * 6); hash_floats.extend_from_slice(&[ @@ -230,7 +213,7 @@ impl Engine { if is_box { 1.0 } else { 0.0 }, clamp_edges, ]); - for p in points { + for p in &points { hash_floats.extend_from_slice(&[p.x as f32, p.y as f32, p.lx as f32, p.ly as f32, p.rx as f32, p.ry as f32]); } let key = self.make_key(node, "PolylineMask", size, &[prev_hash], &hash_floats); @@ -245,42 +228,85 @@ impl Engine { let need_post = soft_px >= 0.5 || prev_mask.is_some(); let pixels = rasterize_polyline_mask( size, - points, + &points, [center[0] as f32, center[1] as f32], if need_post { false } else { invert }, if need_post { 1.0 } else { level }, ); - let raw_tex = create_texture(&self.device, size, if need_post { 0 } else { key }); - self.queue.write_texture( - raw_tex.texture.as_image_copy(), - &pixels, - wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(size[0] * 4), rows_per_image: Some(size[1]) }, - wgpu::Extent3d { width: size[0], height: size[1], depth_or_array_layers: 1 }, - ); - let tex = if need_post { - let blurred = if soft_px >= 0.5 { - self.blur_mask_texture(enc, &raw_tex, soft_px, is_box, clamp_edges) - } else { - raw_tex - }; - let combined = create_texture(&self.device, size, key); - let mut u = UniformParams::default(); - u.p[0] = [ - paint_mode, - if invert { 1.0 } else { 0.0 }, - level, - if prev_mask.is_some() { 1.0 } else { 0.0 }, - ]; - let mv = prev_mask.as_ref().map_or(&self.dummy.view, |m| &m.view); - self.dispatch_op(enc, ShaderOp::MaskCombine, &blurred.view, &self.dummy.view, mv, &combined, &u); - combined - } else { - raw_tex - }; + let post = need_post.then_some(MaskPost { + soft_px, + is_box, + clamp_edges, + paint_mode, + invert, + level, + prev: prev_mask.as_ref(), + }); + let tex = self.upload_cpu_mask(enc, size, key, &pixels, post); self.cache.insert(key, tex.clone(), node.id, frame_i); tex } + /// Mask size from explicit `MaskWidth`/`MaskHeight`, else the inherited target size, else the comp's. + pub(super) fn explicit_mask_size(&self, comp: &Comp, node: &Node, time: f64, comp_dims: [u32; 2]) -> [u32; 2] { + if node.inputs.contains_key("MaskWidth") || node.inputs.contains_key("MaskHeight") { + let w = comp.eval_number(node, "MaskWidth", time, comp.width as f64, &self.expr) as u32; + let h = comp.eval_number(node, "MaskHeight", time, comp.height as f64, &self.expr) as u32; + if w >= 16 && h >= 16 { + return self.scaled_dims(w, h); + } + return comp_dims; + } + self.mask_target_size.unwrap_or(comp_dims) + } + + /// Control points of `node`'s `Polyline` input: animated spline, `PolyPath` modifier, or inline value. + pub(super) fn polyline_points(comp: &Comp, node: &Node, time: f64) -> Vec { + if let Some(src) = node.connected_node("Polyline") { + if let Some(pts) = comp.eval_polyline_spline(src, time) { + return pts; + } + return comp.poly_paths.get(src).map(|pp| pp.points.clone()).unwrap_or_default(); + } + node.raw + .get_table("Inputs") + .and_then(|i| i.get_table("Polyline").or_else(|| i.get_table("PolyLine"))) + .and_then(|p| p.get_table("Value")) + .map(|t| model::PolyPath::parse_polyline_table(t).1) + .unwrap_or_default() + } + + /// Uploads CPU-rasterized RGBA8 mask `pixels`; with `post`, applies `SoftEdge`, `Invert`, `Level` + /// and `PaintMode` chaining against the previous mask on the GPU. + pub(super) fn upload_cpu_mask( + &self, + enc: &mut wgpu::CommandEncoder, + size: [u32; 2], + key: u64, + pixels: &[u8], + post: Option, + ) -> CachedTexture { + let raw_tex = create_texture(&self.device, size, if post.is_some() { 0 } else { key }); + self.queue.write_texture( + raw_tex.texture.as_image_copy(), + pixels, + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(size[0] * 4), rows_per_image: Some(size[1]) }, + wgpu::Extent3d { width: size[0], height: size[1], depth_or_array_layers: 1 }, + ); + let Some(p) = post else { return raw_tex }; + let blurred = if p.soft_px >= 0.5 { + self.blur_mask_texture(enc, &raw_tex, p.soft_px, p.is_box, p.clamp_edges) + } else { + raw_tex + }; + let combined = create_texture(&self.device, size, key); + let mut u = UniformParams::default(); + u.p[0] = [p.paint_mode, if p.invert { 1.0 } else { 0.0 }, p.level, if p.prev.is_some() { 1.0 } else { 0.0 }]; + let mv = p.prev.map_or(&self.dummy.view, |m| &m.view); + self.dispatch_op(enc, ShaderOp::MaskCombine, &blurred.view, &self.dummy.view, mv, &combined, &u); + combined + } + #[allow(clippy::too_many_arguments)] pub(super) fn eval_bitmap_mask( &mut self, diff --git a/crates/engine/src/eval/mod.rs b/crates/engine/src/eval/mod.rs index ceaf72b0b38a3b3ea4e2156c290d413ba5d9f313..9885924a7af3360b3489add4ea0d9c31a2382c00 100644 --- a/crates/engine/src/eval/mod.rs +++ b/crates/engine/src/eval/mod.rs @@ -18,6 +18,7 @@ mod color; mod blur_glow; mod keyers; mod masks; +mod paint; mod shapes_warp; mod text_3d; @@ -932,7 +933,7 @@ impl Engine { let frame_i = time.round() as i64; let is_mask_node = matches!( comp.node(id).kind.as_str(), - "EllipseMask" | "RectangleMask" | "PolylineMask" + "EllipseMask" | "RectangleMask" | "PolylineMask" | "PaintMask" ); let memo_sz = if is_mask_node { self.mask_target_size } else { None }; // Always memoize within a single frame's DAG pass so diamond graphs never explode @@ -967,7 +968,13 @@ impl Engine { if node.bypassed || matches!( node.kind.as_str(), - "Saver" | "PipeRouter" | "Fuse.Wireless" | "Tracker" | "Dimension.OpticalFlow" | "OpticalFlow" + "Saver" + | "PipeRouter" + | "Fuse.Wireless" + | "Tracker" + | "Dimension.OpticalFlow" + | "OpticalFlow" + | "Dimension.CopyAux" ) { let port = default_main_input_port(&node.kind); @@ -1119,6 +1126,9 @@ impl Engine { "EllipseMask" => self.eval_mask_shape(comp, node, time, frame_i, comp_dims, 0, enc, visiting, stats), "RectangleMask" => self.eval_mask_shape(comp, node, time, frame_i, comp_dims, 1, enc, visiting, stats), "PolylineMask" => self.eval_polyline_mask(comp, node, time, frame_i, comp_dims, enc, visiting, stats), + "Paint" => self.eval_paint(comp, node, time, frame_i, comp_dims, enc, visiting, stats), + "PaintMask" => self.eval_paint_mask(comp, node, time, frame_i, comp_dims, enc, visiting, stats), + "PolylineStroke" | "Multistroke" => self.dummy.clone(), "BitmapMask" => self.eval_bitmap_mask(comp, node, time, frame_i, comp_dims, enc, visiting, stats), "WandMask" => self.eval_wand_mask(comp, node, time, frame_i, comp_dims, enc, visiting, stats), "TextPlus" => self.eval_text_plus(comp, node, time, frame_i, comp_dims, enc, stats), diff --git a/crates/engine/src/eval/paint.rs b/crates/engine/src/eval/paint.rs new file mode 100644 index 0000000000000000000000000000000000000000..e46f41fdab614e4b46e42c34fb6c04e56fb258a5 --- /dev/null +++ b/crates/engine/src/eval/paint.rs @@ -0,0 +1,509 @@ +//! Fusion `Paint` / `PaintMask`: `PolylineStroke` and `Multistroke` chains are CPU-rasterized +//! into one RGBA layer that the GPU then composites (`Paint`) or post-processes as a mask (`PaintMask`). + +use super::masks::MaskPost; +use super::*; +use model::{LuaTable, LuaValue, PolyPoint}; + +/// Fusion stroke coordinates are centered on the image, Y-up, and normalized per axis. +struct Stroke { + path: Vec<[f32; 2]>, + write_on: [f32; 2], + /// Brush diameter as a fraction of image width. + size: f32, + softness: f32, + color: [f32; 3], + opacity: f32, + erase: bool, +} + +impl Stroke { + fn hash_into(&self, out: &mut Vec) { + out.extend_from_slice(&[self.write_on[0], self.write_on[1], self.size, self.softness, self.opacity]); + out.extend_from_slice(&self.color); + out.push(if self.erase { 1.0 } else { 0.0 }); + out.push(self.path.len() as f32); + out.extend(self.path.iter().flatten()); + } +} + +const BEZIER_STEPS: usize = 24; + +fn flatten_polyline(points: &[PolyPoint]) -> Vec<[f32; 2]> { + let mut out: Vec<[f32; 2]> = points.first().map(|p| [p.x as f32, p.y as f32]).into_iter().collect(); + for pair in points.windows(2) { + let (a, b) = (&pair[0], &pair[1]); + if a.linear && b.linear { + out.push([b.x as f32, b.y as f32]); + continue; + } + let p = [[a.x, a.y], [a.x + a.rx, a.y + a.ry], [b.x + b.lx, b.y + b.ly], [b.x, b.y]]; + for k in 1..=BEZIER_STEPS { + let t = k as f64 / BEZIER_STEPS as f64; + let u = 1.0 - t; + let w = [u * u * u, 3.0 * u * u * t, 3.0 * u * t * t, t * t * t]; + out.push([0, 1].map(|i| (0..4).map(|j| w[j] * p[j][i]).sum::() as f32)); + } + } + out +} + +fn fuid(v: &LuaValue) -> Option<&str> { + v.as_table()?.get_index(1)?.as_str() +} + +/// Walks `head`'s `Paint` input chain and returns the strokes visible at `time`, oldest first. +fn collect_strokes(comp: &Comp, head: &Node, time: f64, expr: &ExprEngine) -> Vec { + let mut chain: Vec<&Node> = Vec::new(); + let mut next = head.connected_node("Paint"); + while let Some(n) = next.and_then(|s| comp.find_node(s)).map(|id| comp.node(id)) { + if chain.iter().any(|c| c.id == n.id) { + break; + } + chain.push(n); + next = n.connected_node("Paint"); + } + + let mut strokes = Vec::new(); + for node in chain.into_iter().rev().filter(|n| !n.bypassed) { + match node.kind.as_str() { + "PolylineStroke" => { + let path = flatten_polyline(&Engine::polyline_points(comp, node, time)); + strokes.extend(stroke_style(comp, node, time, expr, None).map(|mut s| { + s.write_on = [ + comp.eval_number(node, "WriteOnStart", time, 0.0, expr) as f32, + comp.eval_number(node, "WriteOnEnd", time, 1.0, expr) as f32, + ]; + s.path = path; + s + })); + } + "Multistroke" => { + let Some(list) = node.raw.get_table("Strokes") else { continue }; + for st in list.positional_values().filter_map(LuaValue::as_table) { + let params = st.get_table("Params"); + let Some(mut s) = stroke_style(comp, node, time, expr, params) else { continue }; + let start = st.get_f64("Time").unwrap_or(0.0); + let duration = stroke_number(comp, node, time, expr, params, "Duration", 1.0); + if time < start || time >= start + duration { + continue; + } + s.path = st + .positional_values() + .filter_map(LuaValue::as_table) + .map(|p| [p.get_f64("X").unwrap_or(0.0) as f32, p.get_f64("Y").unwrap_or(0.0) as f32]) + .collect(); + strokes.push(s); + } + } + _ => {} + } + } + strokes.retain(|s| !s.path.is_empty()); + strokes +} + +/// Per-stroke `Params` override the node's inputs of the same name. +fn stroke_number( + comp: &Comp, + node: &Node, + time: f64, + expr: &ExprEngine, + params: Option<&LuaTable>, + key: &str, + default: f64, +) -> f64 { + params + .and_then(|p| p.get_table(key)) + .and_then(|t| t.get_f64("Value")) + .unwrap_or_else(|| comp.eval_number(node, key, time, default, expr)) +} + +/// Brush and apply-mode controls; `None` for apply modes this engine does not rasterize (e.g. `Clone`). +fn stroke_style( + comp: &Comp, + node: &Node, + time: f64, + expr: &ExprEngine, + params: Option<&LuaTable>, +) -> Option { + let num = |key: &str, default: f64| stroke_number(comp, node, time, expr, params, key, default) as f32; + let mode = params + .and_then(|p| p.get_table("ApplyMode")?.get("Value")) + .and_then(fuid) + .or_else(|| node.raw.get_table("ApplyModes")?.get_index(1)?.as_str()) + .unwrap_or("PaintApplyColor"); + let erase = match mode { + "PaintApplyColor" | "PaintApplyMerge" => false, + "PaintApplyErase" => true, + _ => return None, + }; + let brush = node + .static_str("BrushShape") + .or_else(|| node.raw.get_table("Brushes")?.get_index(1)?.as_str()) + .unwrap_or("SoftBrush"); + Some(Stroke { + path: Vec::new(), + write_on: [0.0, 1.0], + size: num(&format!("{brush}.Size"), 0.01), + softness: if brush == "SoftBrush" { num("SoftBrush.Softness", 0.5).clamp(0.0, 1.0) } else { 0.0 }, + color: [ + num("PaintApplyColor.Red", 1.0), + num("PaintApplyColor.Green", 1.0), + num("PaintApplyColor.Blue", 1.0), + ], + opacity: num(&format!("{mode}.Opacity"), 1.0).clamp(0.0, 1.0), + erase, + }) +} + +/// Brush stamp positions along `path` (pixels) between the `write_on` fractions of its arclength. +fn stamp_positions(path: &[[f32; 2]], write_on: [f32; 2], spacing: f32) -> Vec<[f32; 2]> { + let Some(&first) = path.first() else { return Vec::new() }; + let [start, end] = write_on.map(|v| v.clamp(0.0, 1.0)); + if end <= start { + return Vec::new(); + } + let mut cum = vec![0.0f32]; + for w in path.windows(2) { + cum.push(cum.last().unwrap() + (w[1][0] - w[0][0]).hypot(w[1][1] - w[0][1])); + } + let total = *cum.last().unwrap(); + if total < 1e-4 { + return vec![first]; + } + let (d0, d1) = (start * total, end * total); + let n = ((d1 - d0) / spacing).ceil() as usize; + (0..=n) + .map(|k| { + let d = (d0 + k as f32 * spacing).min(d1); + let i = cum.partition_point(|&c| c < d).clamp(1, path.len() - 1); + let t = (d - cum[i - 1]) / (cum[i] - cum[i - 1]).max(1e-6); + [0, 1].map(|a| path[i - 1][a] + (path[i][a] - path[i - 1][a]) * t) + }) + .collect() +} + +/// Coverage of a round brush of radius `r` at distance `d` from its center. +fn brush_coverage(d: f32, r: f32, softness: f32) -> f32 { + if softness <= 0.0 { + return (r + 0.5 - d).clamp(0.0, 1.0); + } + let t = ((r - d) / (r * softness).max(1e-3)).clamp(0.0, 1.0); + t * t * (3.0 - 2.0 * t) +} + +/// Rasterizes `strokes` in order into a premultiplied RGBA float layer, top row first. +fn render_strokes(strokes: &[Stroke], [w, h]: [u32; 2]) -> Vec<[f32; 4]> { + let mut layer = vec![[0.0f32; 4]; (w * h) as usize]; + for s in strokes { + let r = (s.size * w as f32 * 0.5).max(0.5); + let px: Vec<[f32; 2]> = s.path.iter().map(|p| [(0.5 + p[0]) * w as f32, (0.5 - p[1]) * h as f32]).collect(); + let stamps = stamp_positions(&px, s.write_on, (r * 0.2).max(0.5)); + let bounds = stamps.iter().fold([f32::MAX, f32::MAX, f32::MIN, f32::MIN], |b, p| { + [b[0].min(p[0]), b[1].min(p[1]), b[2].max(p[0]), b[3].max(p[1])] + }); + let x0 = (bounds[0] - r - 1.0).floor().max(0.0) as u32; + let y0 = (bounds[1] - r - 1.0).floor().max(0.0) as u32; + let x1 = ((bounds[2] + r + 1.0).ceil().max(0.0) as u32).min(w); + let y1 = ((bounds[3] + r + 1.0).ceil().max(0.0) as u32).min(h); + if stamps.is_empty() || x0 >= x1 || y0 >= y1 { + continue; + } + let bw = (x1 - x0) as usize; + let mut cov = vec![0.0f32; bw * (y1 - y0) as usize]; + for c in &stamps { + let (sx0, sx1) = (((c[0] - r - 1.0).floor().max(x0 as f32)) as u32, ((c[0] + r + 1.0).ceil().min(x1 as f32)) as u32); + let (sy0, sy1) = (((c[1] - r - 1.0).floor().max(y0 as f32)) as u32, ((c[1] + r + 1.0).ceil().min(y1 as f32)) as u32); + for y in sy0..sy1 { + for x in sx0..sx1 { + let d = (x as f32 + 0.5 - c[0]).hypot(y as f32 + 0.5 - c[1]); + let v = &mut cov[(y - y0) as usize * bw + (x - x0) as usize]; + *v = v.max(brush_coverage(d, r, s.softness)); + } + } + } + for y in y0..y1 { + for x in x0..x1 { + let a = cov[(y - y0) as usize * bw + (x - x0) as usize] * s.opacity; + let px = &mut layer[(y * w + x) as usize]; + if s.erase { + px.iter_mut().for_each(|c| *c *= 1.0 - a); + } else { + let color = [s.color[0], s.color[1], s.color[2], 1.0]; + for (c, k) in px.iter_mut().zip(color) { + *c = k * a + *c * (1.0 - a); + } + } + } + } + } + layer +} + +fn to_rgba8(layer: &[[f32; 4]], map: impl Fn([f32; 4]) -> [f32; 4]) -> Vec { + layer.iter().flat_map(|&p| map(p).map(|v| (v.clamp(0.0, 1.0) * 255.0).round() as u8)).collect() +} + +impl Engine { + #[allow(clippy::too_many_arguments)] + pub(super) fn eval_paint( + &mut self, + comp: &Comp, + node: &Node, + time: f64, + frame_i: i64, + comp_dims: [u32; 2], + enc: &mut wgpu::CommandEncoder, + visiting: &mut HashSet<(NodeId, i64)>, + stats: &mut EvalStats, + ) -> CachedTexture { + let src = match node.connected_node("Input").and_then(|s| comp.find_node(s)) { + Some(id) => self.eval_node(comp, id, time, enc, visiting, stats), + None => self.alloc_tex(comp_dims, BitDepth::Int8, 0), + }; + let blend = comp.eval_number(node, "Blend", time, 1.0, &self.expr) as f32; + let strokes = collect_strokes(comp, node, time, &self.expr); + if blend <= 1e-6 || strokes.is_empty() { + return src; + } + let src = self.crop_to_canvas(enc, src); + let (mask, mask_inv) = self.eval_mask_input_sized(comp, node, time, Some(src.size), enc, visiting, stats); + let mask_hash = mask.as_ref().map_or(0, |m| m.content_hash); + + let mut params = vec![blend]; + strokes.iter().for_each(|s| s.hash_into(&mut params)); + let mut u = UniformParams::default(); + u.p[0] = [0.5, 0.5, 1.0, 0.0]; + u.p[1] = [blend, 1.0, 0.0, 0.0]; + u.p[2] = [0.0, 0.0, 1.0, 0.0]; + u.p[3] = [ + if mask.is_some() { 1.0 } else { 0.0 }, + if mask_inv { 1.0 } else { 0.0 }, + src.size[0] as f32, + src.size[1] as f32, + ]; + u.p[6] = [0.0, 1.0, 0.0, 0.0]; + let key = self.make_key(node, "Paint", src.size, &[src.content_hash, mask_hash], ¶ms); + if let Some(hit) = self.cache.get(key, node.id, frame_i) { + stats.cache_hits += 1; + return hit; + } + stats.cache_misses += 1; + stats.nodes_evaluated += 1; + + let pixels = to_rgba8(&render_strokes(&strokes, src.size), |p| p); + let layer = create_texture(&self.device, src.size, 0); + self.queue.write_texture( + layer.texture.as_image_copy(), + &pixels, + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(src.size[0] * 4), rows_per_image: Some(src.size[1]) }, + wgpu::Extent3d { width: src.size[0], height: src.size[1], depth_or_array_layers: 1 }, + ); + let dst = self.alloc_tex_like(&src, src.depth, key); + let mv = mask.as_ref().map_or(&self.dummy.view, |m| &m.view); + self.dispatch_op(enc, ShaderOp::Merge, &src.view, &layer.view, mv, &dst, &u); + self.cache.insert(key, dst.clone(), node.id, frame_i); + dst + } + + #[allow(clippy::too_many_arguments)] + pub(super) fn eval_paint_mask( + &mut self, + comp: &Comp, + node: &Node, + time: f64, + frame_i: i64, + comp_dims: [u32; 2], + enc: &mut wgpu::CommandEncoder, + visiting: &mut HashSet<(NodeId, i64)>, + stats: &mut EvalStats, + ) -> CachedTexture { + let size = self.explicit_mask_size(comp, node, time, comp_dims); + let soft = comp.eval_number(node, "SoftEdge", time, 0.0, &self.expr).max(0.0) as f32; + let invert = comp.eval_number(node, "Invert", time, 0.0, &self.expr) > 0.5; + let level = comp.eval_number(node, "Level", time, 1.0, &self.expr) as f32; + let is_box = Self::mask_filter_is_box(node); + let clamp_edges = Self::mask_clamp_edges(node); + let paint_mode = Self::paint_mode_id(node); + let (prev_mask, _) = self.eval_mask_input_sized(comp, node, time, Some(size), enc, visiting, stats); + let prev_hash = prev_mask.as_ref().map_or(0, |m| m.content_hash); + let strokes = collect_strokes(comp, node, time, &self.expr); + + let mut params = vec![soft, invert as u8 as f32, level, paint_mode, is_box as u8 as f32, clamp_edges]; + strokes.iter().for_each(|s| s.hash_into(&mut params)); + let key = self.make_key(node, "PaintMask", size, &[prev_hash], ¶ms); + if let Some(hit) = self.cache.get(key, node.id, frame_i) { + stats.cache_hits += 1; + return hit; + } + stats.cache_misses += 1; + stats.nodes_evaluated += 1; + + let pixels = to_rgba8(&render_strokes(&strokes, size), |p| [p[3]; 4]); + let post = MaskPost { + soft_px: soft * size[0] as f32, + is_box, + clamp_edges, + paint_mode, + invert, + level, + prev: prev_mask.as_ref(), + }; + let tex = self.upload_cpu_mask(enc, size, key, &pixels, Some(post)); + self.cache.insert(key, tex.clone(), node.id, frame_i); + tex + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::Engine; + + const POLYLINE: &str = "Polyline = Input { Value = Polyline { Points = { + { Linear = true, X = -0.25, Y = 0.25, RX = 0.1, RY = 0 }, + { Linear = true, X = 0.25, Y = 0.25, LX = -0.1, LY = 0 }, + } }, },"; + + fn comp_src(tools: &str) -> String { + format!( + r#"Composition {{ + CurrentTime = 0, RenderRange = {{ 0, 10 }}, GlobalRange = {{ 0, 10 }}, + Tools = ordered() {{ + BG = Background {{ Inputs = {{ + Width = Input {{ Value = 64, }}, Height = Input {{ Value = 64, }}, + TopLeftAlpha = Input {{ Value = 1.0, }}, + }}, }}, + {tools} + }} + }}"# + ) + } + + fn stroke(path: &[[f32; 2]], softness: f32, erase: bool) -> Stroke { + Stroke { + path: path.to_vec(), + write_on: [0.0, 1.0], + size: 0.2, + softness, + color: [1.0, 0.5, 0.0], + opacity: 1.0, + erase, + } + } + + fn alpha_at(layer: &[[f32; 4]], x: u32, y: u32) -> f32 { + layer[(y * 64 + x) as usize][3] + } + + #[test] + fn write_on_trims_stamps_by_arclength() { + let path = [[0.0, 10.0], [100.0, 10.0]]; + let half = stamp_positions(&path, [0.0, 0.5], 5.0); + assert_eq!(half.first(), Some(&[0.0, 10.0])); + assert!((half.last().unwrap()[0] - 50.0).abs() < 1e-3); + assert!(stamp_positions(&path, [0.5, 0.5], 5.0).is_empty()); + assert_eq!(stamp_positions(&[[3.0, 4.0], [3.0, 4.0]], [0.0, 1.0], 5.0), vec![[3.0, 4.0]]); + } + + #[test] + fn soft_brush_falls_off_and_hard_brush_is_flat() { + let dot = [[0.0, 0.0]]; + let hard = render_strokes(&[stroke(&dot, 0.0, false)], [64, 64]); + let soft = render_strokes(&[stroke(&dot, 1.0, false)], [64, 64]); + // radius = 0.2 * 64 / 2 = 6.4px around (32, 32) + assert_eq!(alpha_at(&hard, 32, 32), 1.0); + assert_eq!(alpha_at(&hard, 35, 32), 1.0); + assert_eq!(alpha_at(&hard, 40, 32), 0.0); + assert!(alpha_at(&soft, 32, 32) > 0.95); + let mid = alpha_at(&soft, 35, 32); + assert!(mid > 0.0 && mid < 1.0, "soft falloff {mid}"); + assert!(alpha_at(&soft, 37, 32) < mid); + assert_eq!(hard[(32 * 64 + 32) as usize], [1.0, 0.5, 0.0, 1.0]); + } + + #[test] + fn erase_removes_earlier_paint_only() { + let dot = [[0.0, 0.0]]; + let layer = render_strokes(&[stroke(&dot, 0.0, false), stroke(&[[0.5, 0.0]], 0.0, true)], [64, 64]); + assert_eq!(alpha_at(&layer, 32, 32), 1.0); + let erased = render_strokes(&[stroke(&dot, 0.0, false), stroke(&dot, 0.0, true)], [64, 64]); + assert_eq!(erased[(32 * 64 + 32) as usize], [0.0; 4]); + } + + #[test] + fn multistroke_is_visible_only_within_its_duration() { + let src = comp_src( + r#"Stroke = Multistroke { + Brushes = { "CircleBrush" }, + ApplyModes = { "PaintApplyColor", "PaintApplyErase" }, + Inputs = { BrushShape = Input { Value = FuID { "CircleBrush" }, }, }, + Strokes = { + { Time = 4, { X = 0, Y = 0, T = 0 }, { X = 0.1, Y = 0, T = 5 } }, + { Time = 6, Params = { Duration = { Value = 3 }, ApplyMode = { Value = FuID { "PaintApplyErase" } } }, + { X = 0, Y = 0, T = 0 } }, + { Time = 6, Params = { ApplyMode = { Value = FuID { "PaintApplyClone" } } }, { X = 0, Y = 0, T = 0 } }, + }, + }, + Paint1 = Paint { Inputs = { + Input = Input { SourceOp = "BG", Source = "Output", }, + Paint = Input { SourceOp = "Stroke", Source = "Out", }, + }, },"#, + ); + let comp = Comp::from_fusion_str(&src).expect("parse"); + let expr = ExprEngine::new(); + let paint = comp.node(comp.find_node("Paint1").unwrap()); + let count = |t: f64| collect_strokes(&comp, paint, t, &expr).iter().map(|s| s.erase).collect::>(); + assert_eq!(count(3.0), Vec::::new()); + assert_eq!(count(4.0), vec![false]); + assert_eq!(count(5.0), Vec::::new()); + assert_eq!(count(7.0), vec![true]); + assert_eq!(count(9.0), Vec::::new()); + } + + #[test] + fn paint_composites_polyline_write_on_over_input() { + let src = comp_src(&format!( + r#"Stroke = PolylineStroke {{ + Brushes = {{ "CircleBrush" }}, ApplyModes = {{ "PaintApplyColor" }}, + Inputs = {{ + BrushShape = Input {{ Value = FuID {{ "CircleBrush" }}, }}, + ["CircleBrush.Size"] = Input {{ Value = 0.1, }}, + WriteOnEnd = Input {{ Value = 0.5, }}, + {POLYLINE} + }}, + }}, + Paint1 = Paint {{ Inputs = {{ + Input = Input {{ SourceOp = "BG", Source = "Output", }}, + Paint = Input {{ SourceOp = "Stroke", Source = "Out", }}, + }}, }}, + Mask1 = PaintMask {{ Inputs = {{ + MaskWidth = Input {{ Value = 64, }}, MaskHeight = Input {{ Value = 64, }}, + Paint = Input {{ SourceOp = "Stroke", Source = "Out", }}, + }}, }}, + Aux1 = Dimension.CopyAux {{ Inputs = {{ + Input = Input {{ SourceOp = "BG", Source = "Output", }}, + }}, }},"# + )); + let comp = Comp::from_fusion_str(&src).expect("parse"); + let Ok(mut eng) = Engine::new_headless() else { return }; + let mut read = |name: &str| { + let (tex, stats) = eng.evaluate(&comp, comp.find_node(name).unwrap(), 0.0); + assert!(stats.unsupported_nodes.is_empty(), "{:?}", stats.unsupported_nodes); + eng.readback_rgba(&tex).expect("readback") + }; + let px = |img: &[u8], x: usize, y: usize| <[u8; 4]>::try_from(&img[(y * 64 + x) * 4..][..4]).unwrap(); + + let painted = read("Paint1"); + assert_eq!(px(&painted, 20, 16), [255; 4], "written half is white"); + assert_eq!(px(&painted, 44, 16), [0, 0, 0, 255], "un-written half stays input"); + assert_eq!(px(&painted, 20, 48), [0, 0, 0, 255], "away from the stroke stays input"); + + let mask = read("Mask1"); + assert_eq!(px(&mask, 20, 16), [255; 4]); + assert_eq!(px(&mask, 44, 16), [0; 4]); + + assert_eq!(read("Aux1"), read("BG"), "CopyAux passes RGBA through"); + } +} diff --git a/crates/model/src/comp.rs b/crates/model/src/comp.rs index d22bea5a044426309a44fd4d3743b16602504cf4..35f8886840c0287eb2997b3d790f40bf3f567119 100644 --- a/crates/model/src/comp.rs +++ b/crates/model/src/comp.rs @@ -138,6 +138,10 @@ pub fn is_supported_tool(kind: &str) -> bool { | "PolylineMask" | "BitmapMask" | "WandMask" + | "Paint" + | "PaintMask" + | "PolylineStroke" + | "Multistroke" | "TextPlus" | "Fuse.Colorize" | "Fuse.Outline" @@ -145,6 +149,7 @@ pub fn is_supported_tool(kind: &str) -> bool { | "Fuse.Cryptomatte" | "Cryptomatte" | "Dimension.OpticalFlow" + | "Dimension.CopyAux" | "OpticalFlow" | "Custom" // Modifiers diff --git a/scripts/gen_compatibility.py b/scripts/gen_compatibility.py index 0df90307109680b19542b51bf954b98adae22c5b..2d6637864371133aff7892346017bf57552886fa 100755 --- a/scripts/gen_compatibility.py +++ b/scripts/gen_compatibility.py @@ -65,6 +65,9 @@ TOOL_METADATA: Sequence[ToolMeta] = ( # Compositing & Blending ToolMeta("Merge", "Compositing & Blending", "`merge`", "0.0%–0.3%", "All ApplyModes (`Normal`, `Screen`, `Multiply`, `Difference`, `DarkerColor`, `Overlay`, `Hard/Soft/Linear/VividLight`, `LinearDodge`, etc.), `Operator=Over/Under`, `Gain`, `BurnIn`, `SubtractiveAdditive`, `Blend`, effect mask."), ToolMeta("Dissolve", "Compositing & Blending", "`tier1_b`", "0.0%–0.1%", "Mix (`Mix = 0..1`) between `Background` and `Foreground` with effect mask support."), + ToolMeta("Paint", "Compositing & Blending", "Unit tests", "Visual*", "Composites the `Paint` stroke chain (`PolylineStroke` / `Multistroke`) over `Input` with `Blend` and `EffectMask`. CPU-rasterized round `CircleBrush` / `SoftBrush` (`Size`, `Softness`), `PaintApplyColor` (`Red`/`Green`/`Blue`/`Opacity`) and `PaintApplyErase` (erases earlier strokes). *Brush size/softness falloff are not Fusion-calibrated; `Clone` and other apply modes are skipped."), + ToolMeta("PolylineStroke", "Compositing & Blending", "Unit tests", "Visual*", "Bezier/linear `Polyline` (static or animated) with `WriteOnStart`/`WriteOnEnd`; always visible. Rendered only through `Paint` / `PaintMask`."), + ToolMeta("Multistroke", "Compositing & Blending", "Unit tests", "Visual*", "Recorded freehand `Strokes`, visible from `Time` for `Duration` frames (default 1) with per-stroke `Params` overrides (`ApplyMode`, `Size`, `Softness`, color, `Duration`). Per-point `T` is ignored. Rendered only through `Paint` / `PaintMask`."), ToolMeta("Shadow", "Compositing & Blending", "`tier1_b`", "0.1%–0.4%", "Drop shadow offset, softness blur, tint color/alpha, and `ShadowOnly` output."), # Color & Depth @@ -120,6 +123,7 @@ TOOL_METADATA: Sequence[ToolMeta] = ( ToolMeta("PolylineMask", "Masks", "`mask_softedge`, Suite comps", "0.1%–0.4%", "CPU `zeno` Bezier/linear polygon rasterizer with animated keyframed `Polyline` splines, progressive-pyramid `SoftEdge`, `ClippingMode`, `Invert`, `PaintMode`."), ToolMeta("BitmapMask", "Masks", "`mask_softedge`", "0.0%–0.2%", "GPU image-to-mask extraction (`Alpha`/`Luminance`/`Red`/`Green`/`Blue`/`Saturation`/`Lightness`/`Hue`), `Low`/`High` clip, centered 1:1 alignment, `SoftEdge`, `Invert`, `Level`, `PaintMode`."), ToolMeta("WandMask", "Masks", "`archive_3d`", "0.0%–0.3%", "Seeded BFS flood-fill wand mask (`Source`, `SelectionPoint`, `SelectionRange`, `ColorSpace`, `SoftEdge`, `Invert`, `Level`, `PaintMode`)."), + ToolMeta("PaintMask", "Masks", "Unit tests", "Visual*", "Alpha mask of the `Paint` stroke chain (stroke opacity, erase), `MaskWidth`/`MaskHeight`, `SoftEdge`, `Filter`, `ClippingMode`, `Invert`, `Level`, `PaintMode` chaining. *Brush falloff is not Fusion-calibrated."), # 2D Vector Shapes ToolMeta("sRender", "2D Vector Shapes", "Unit tests", "0.0%", "Antialiased `zeno` 2D vector shape tree rasterizer (`Width`, `Height`, `Blend`, `EffectMask`, cached RGBA upload & `HiQ` depth promotion)."), @@ -171,6 +175,7 @@ TOOL_METADATA: Sequence[ToolMeta] = ( # Time, Routing & Utility ToolMeta("Saver", "Time, Routing & Utility", "All suites", "0.0%", "Output sink / passthrough in interactive Flow; Saver-driven pipelined PNG sequence export (`render-check --export` and `Cmd+Shift+R`)."), ToolMeta("Dimension.OpticalFlow", "Time, Routing & Utility", "Unit tests", "0.1%", "GPU 4-level pyramid coarse-to-fine bidirectional dense optical flow feeding downstream `TimeStretcher` flow interpolation.", aliases=("OpticalFlow",)), + ToolMeta("Dimension.CopyAux", "Time, Routing & Utility", "Unit tests", "Visual*", "Passes the RGBA `Input` through unchanged in both `Mode`s. *The engine carries no auxiliary planes (`Z`, `Coverage`, `ObjectID`, `Vector`, ...), so `Channel` is ignored and aux-to-color output is not produced."), ToolMeta("TimeStretcher", "Time, Routing & Utility", "Suite comps", "0.0%–0.2%", "Keyframed/expression `SourceTime` remapping with `Nearest` (`0`), `Blend` (`1`), and GPU `OpticalFlow` (`2`) bidirectional warped interpolation."), ToolMeta("TimeSpeed", "Time, Routing & Utility", "Suite comps", "0.0%", "Constant/animated `Speed` and `Delay` time remapping."), ToolMeta("Switch", "Time, Routing & Utility", "Suite comps", "0.0%", "Dynamic input routing by `Which` index (`Input1`..`InputN`)."), @@ -218,7 +223,6 @@ UNSUPPORTED_NOTES: Sequence[UnsupportedMeta] = ( UnsupportedMeta("SurfaceTracker", "Preserved lossless on save; passes through main image input in Flow.", 7), UnsupportedMeta("MagicMask", "Preserved lossless on save; passes through main image input in Flow.", 7), UnsupportedMeta("PlanarTracker", "Preserved lossless on save; passes through main image input in Flow.", 7), - UnsupportedMeta("Dimension.CopyAux", "Preserved lossless on save; passes through main image input.", None), ) -- 2.54.1