#49better magic mask tool

  • avatar~clovercommented · 14 hours ago
    Author
    Owner

    better magic mask

    clover has to find the algorithm

  • avatar~clover changed the status to Todo · 14 hours ago
  • avatar~clover added label human · 14 hours ago
  • avatar~clover changed the status to Needs Triage · 11 hours ago
  • avatar~clover changed the status to Todo · 11 hours ago
  • avatar~clover removed label human · 11 hours ago
  • avatar~clover changed title from
    custom tool: AutoMatte · 11 hours ago
    to
    better magic mask tool
  • Gemini 4 Neon (on behalf of ~clover) commented · 11 hours ago

    Architecture plan for AutoMatte (and diverging MagicMask compatibility):

    • Unified GPU engine in crates/engine/src/auto_matte.rs + shaders/auto_matte.wgsl supporting both Fission's 1-click AutoMatte node (+/- points, AutoPerson, quality tiers) and imported Fusion MagicMask nodes (converting MagicMaskStrokes into +/- prompt seeds).
    • Real-time GPU Stage 3: WGSL port of polish_alpha (black floor, white ceiling, toe compression) + multi-scale normalized-convolution hair_safe_decontaminate (from ~/dev/magic-matte/test_polish.py) for clean foreground RGB unmixing at 120fps.
    • Pluggable neural cache + built-in fallback: Reads/writes cached per-frame SAM 2 + MatAnyone 2 / VideoMaMa mattes when backed by the neural runner, with a fast built-in GPU color-GMM + bilateral-guided segmentation fallback so both AutoMatte and MagicMask work everywhere (including WASM).
    • Mark MagicMask as ⚠️ Diverging Implementation in compatibility.md.

    Assisted-by: gemini-4-neon

  • Gemini 4 Hydrogen (on behalf of ~clover) commented · 10 hours ago

    Engine implementation for AutoMatte and diverging MagicMask landed on main (umsruvny → 0cf6bd1d):

    • GPU Compute Pipeline (crates/engine/src/shaders/auto_matte.wgsl, WebGPU/wasm32-safe):
      • Multi-seed Oklab perceptual segmentation + à-trous joint-bilateral edge refinement GPU fallback when no external neural runner is attached.
      • Exact GPU port of polish_alpha (lo = 0.045, hi = 0.985, toe gamma 1.35 below 0.15, optional invert) + separable morphology (MatteContractExpand) and Gaussian blur (MatteBlur).
      • 3-scale coarse-to-fine normalized-convolution hair_safe_decontaminate (sigma = 28, 12, 4 in Rgba16Float from solid_w = clamp((alpha - 0.82) / 0.14, 0, 1)) + clean foreground/matte/overlay compositing.
    • Neural Matte Bridge & Cache (crates/engine/src/auto_matte.rs, auto_matte/prompts.rs): supports positive/negative point & stroke prompts (Points, Strokes, Model, OutputMode), external SAM 2 + MatAnyone 2 / VideoMaMa runner cache integration, and empty-stroke passthrough for existing Fusion MagicMask comps.
    • Registered in model::is_supported_tool, add_tool.rs, and compatibility.md (AutoMatte as Native, MagicMask as ⚠️ Diverging).

    Keeping #49 open for the interactive 1-click Viewer click/stroke gizmo & Inspector controls in crates/app / crates/viewer.

    Assisted-by: gemini-4-hydrogen