Skip to content

Motion blur: elements that smear along how they move while the shutter is open #565

Open

Description

@michael-dm

Why: live video tools draw on-air graphics (lower thirds, scorebugs, tickers) as HTML in an embedded Chromium, which costs a browser per graphic and runs on its own clock. Rune rendering straight onto the video pipeline's wgpu device would be a far lighter replacement. That use needs frames driven by the host's clock, and no stalls or crashes on air.

Next to camera video, graphics without motion blur strobe: a 25p camera's shutter smears everything that moves, and a lower third sliding beside it steps. A per-pixel velocity buffer, as games use, doesn't fit: a pixel of a graphic often holds a fading card over a moving one, with no depth buffer to separate them. The code that animates an element already knows how it moves while the shutter is open, so the element can smear itself.

What worked in a prototype on Rune's renderer:

  • An element binds its motion over the shutter (live_motion_blur): how its box moves and resizes, and how its turn and scale change. Paint makes that an affine field over the element's layer, linear · p + offset, so slides, turns, zooms and resizes all smear.
  • Each pixel smears once, along how it moves on screen. A layer holding a layer that moves on its own smears nothing itself and passes its motion down. Words sliding left inside a window sliding right then hold still instead of streaking, and the window's edge fades over where it goes.
  • Two passes per moving layer: fine steps a texel apart, then coarse jumps over what they left, 2√n samples for an n-texel smear. Each pixel takes only as many as its own smear needs, so a turn or a zoom costs least near its still centre. Where every pixel moves far, the fine pass also averages the layer down until a texel spans a 64th of the shortest smear, so a long slide's cost stops growing with resolution.
  • A large sparse layer smears only where its records can reach. Each record lies within a triangle or a box, so the passes find, row by row, where the content is and how far the motion carries it, then draw and composite only those runs. Sixteen thin rays turning across a 4K frame then cost the 18% of it they cover.
  • Small layers share pages, still or moving, so a burst of 140 sparks costs a few passes, not 140 textures and passes.

Against the average of 32 sharp frames across the shutter, 7% of the sharp frame's error is left on average, over twelve moments of five graphics. A stinger's busiest moment at 2160p with a 1/50 shutter takes 8.7 ms on an M5 Pro. Frames with no shutter are unchanged.

Activity

  1. changed the title [-]Motion blur along a motion the host knows[/-] [+]Motion blur: elements that smear along how they move while the shutter is open[/+] on Nov 11, 2026
  2. opencodejr commented on Nov 25, 2026

    @opencodejr
    Contributor

    Thanks for the detailed write-up and the prototype numbers.

    Where Rune is today: core rune has no shutter motion blur for elements. rune-fx has a spike (Fx::motion_blur with MotionBlurParams and MotionSamples::from_track, in Shutter and Directional modes), and its README says what's missing: Rune doesn't yet render the moving subtree into the layer the effect composites, and should skip the effect at rest. PLAN.md ("Effects: motion blur and friends") already plans shutter blur driven by the analytic tracks, so this fits. It ties in with #420, since the shutter has to be stated on the host's clock.

    I'll take this as a feature request and start from the parts you describe:

    • an element binding its motion over the shutter (live_motion_blur), turned into an affine field over its layer at paint time
    • each pixel smearing once, with a layer that holds an independently moving layer passing its motion down
    • the two-pass (fine, then coarse) sampling that scales with each pixel's own smear
    • frames with no shutter staying exactly as they are now

    The sparse-layer row runs and shared pages for small layers look like separate follow-ups for cost.

  3. opencodejr commented on Nov 25, 2026

    @opencodejr
    Contributor

    Thanks again for the detailed proposal. I looked into building it and stopped short of a change, because it's a new renderer pipeline that I can't build or check properly in one pass here:

    • Passes on every backend. The fine and coarse smear passes need new shaders and pipelines in crates/rune/src/render, and built-in passes there ship precompiled DX12 bytecode (render/dxbc.rs) and Metal libraries (render/metallib.rs, crates/rune-gpu/src/metal/builtin.rs). The native Metal backend is on by default, so your M5 Pro numbers depend on that path too.
    • Paint and layers. A live_motion_blur binding becoming an affine field per layer, nested layers passing motion down, sparse row runs and shared pages all touch runtime/paint and render/layers.
    • Checking it. Your numbers (7% of the sharp frame's error left, 8.7 ms at 2160p) need real GPU pixel and timing runs on each backend. I couldn't run those here.
    • The shutter's clock. The shutter has to be stated on the host's clock, which Embedding: frames that depend only on the time they're drawn for #420 covers.

    If your prototype is public or you can open it as a PR, that would be the quickest way forward. Split along your own bullets, each part can be reviewed and tested on its own: the binding and affine field, one moving layer's two-pass smear, nesting, then the sparse-row and shared-page costs. The closest existing pattern in the code is El::live_blur with render/layer_blur.rs. The rune-fx spike (Fx::motion_blur, MotionSamples::from_track) shows how shutter samples are taken today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions