Skip to content

Blur the cursor with the screen and centre zoom blur on the zoom origin - #4417

Open
richiemcilroy wants to merge 5 commits into
mainfrom
fix/motion-blur-cursor-zoom-centre
Open

richiemcilroy wants to merge 5 commits into
mainfrom
fix/motion-blur-cursor-zoom-centre

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Motion blur now treats the cursor as part of the screen it sits on, and zoom blur converges on the point the frame actually scales about.

What changed

  • The cursor blurs with the screen. The cursor's smear follows its motion on the frame, including the screen's pan. The screen's own blur, a pan streak or a zoom blur, is applied over the cursor too, so the cursor no longer stays sharp while everything under it streaks. Its own smear is skipped on frames where the screen's change in size outweighs the cursor's movement (a zoom), where the screen's zoom blur alone applies.
  • Zoom blur centre. The radial blur converges on the fixed point of the frame-to-frame scale, solved per axis from x' = s * x + t. Before, it intersected the paths of opposite corners, which are collinear when the zoom target sits on the frame's diagonal (a centred manual zoom), so the centre jumped between frames. Zooming out used the card's centre instead of the fixed point. The centre is no longer clamped to the card, so a zoom that also pans converges on its real origin.
  • Zoom-in blur trails the motion. The radial taps now run away from the zoom centre while the frame grows and toward it while it shrinks, so both directions smear behind the motion. Before, a zoom in smeared ahead of it. Measured on a 2x zoom export with a frame-by-frame trail fit: zoom-in streak direction went from -1.03 (ahead) to +0.99 (behind); zoom out stays +0.97.
  • New-project zoom spring. New projects zoom with a critically damped spring (stiffness 286, damping 42.2, mass 1.5): 50% of a zoom in 123 ms and 90% in 290 ms, against 139 / 312 ms before, with no overshoot. Saved projects keep the spring they have.
  • Directional kernel. 21 taps at t = 0, 0, 1/20 ... 19/20 along the motion, for the display, camera and cursor.

Before and after

Left is main, right is this branch, from the same project exported at 1080p60.

A fast pan: the cursor now streaks with the screen.
Cursor during a pan

A zoom in: the cursor now takes the same zoom blur as the button under it.
Cursor during a zoom

Testing

  • cargo test -p cap-rendering --lib: 566 pass, 5 new:
    • zoom blur centre lands on the fixed point for zoom in and out, for targets at the centre, on the diagonal, off it and off the card;
    • the display carries a point with the card;
    • a pan smears the cursor;
    • a zoom leaves the cursor to the screen's zoom blur;
    • the screen's blur reaches the cursor in output pixels.
  • Exporting a 22 s project with a 2x follow-click zoom at 1080p60: 204 fps on main, 203 fps on this branch. 689 of 1320 frames are identical; the rest differ only while something moves.
  • cargo test -p cap-rendering (every target), including the cursor edge GPU test, which now checks the new tap spacing.
  • Clippy and rustfmt clean for cap-rendering.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with the existing non-blocking transition blur issue still open.

Findings

  1. P2 Transitions drop remaining pan blur. ▶
Fix with agent prompt
### Issue 1
crates/rendering/src/lib.rs:5208-5213
This filter removes all carried motion as soon as a split or text takeover changes the card bounds. During a partial transition, the card still follows part of the zoom’s pan through `lerp_bounds`, so that motion has not disappeared.

With cursor blur enabled and screen blur disabled, a cursor that stays still on the recording now gets no blur during that pan: `prepare` maps both cursor positions through the current display, and `display_motion = None` removes the only carried-motion term. Compute that term from the final card transform instead of dropping it for the whole transition.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR makes the cursor share the screen’s motion blur and centres zoom blur on the point the frame scales about.

  • The cursor smears with the screen as it moves.
  • Zoom blur converges on the frame’s actual scale origin.
  • New projects reach their zoom size sooner without overshooting.

Reviews (8) · Last reviewed commit: "fix(rendering): zoom-in blur trails the ..." · Reviewed by Greptile

…on the zoom origin

- The cursor's smear follows its motion on the frame, the screen's pan
  included, and the screen's own blur (pan streak or zoom blur) lands on
  the cursor too, so it no longer stays sharp while the screen moves.
- Zoom blur converges on the point the frame scales about, solved per
  axis, for zoom in and out. Pairing opposite corners' paths gave two
  collinear lines for a target on the frame's diagonal (a centred zoom),
  and zoom out used the card's centre.
- Directional blur samples t = 0, 0, 1/20 ... 19/20 over 21 taps.
@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
cap-status Ignored Ignored Preview Nov 20, 2026 12:49am UTC

@sandchest-com

sandchest-com Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Sandchest

Sandchest reviewed 2067d10: nothing exploitable found in this change.

Sandchest reviews every change for vulnerabilities an attacker could use · 1 credit · Review details

@richiemcilroy

Copy link
Copy Markdown
Member Author

@greptileai review

Comment on lines +235 to +241
fn own_blurred(uv: vec2<f32>, velocity_uv: vec2<f32>) -> vec4<f32> {
if (length(velocity_uv) < 0.005) {
return sample_cursor(uv);
}
var color = sample_cursor(uv) * 2.0;
for (var i = 1; i < 20; i = i + 1) {
color += sample_cursor(uv + velocity_uv * (f32(i) / 20.0));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Cursor GPU test breaks. reference_shader() copies everything between screen_bounds_mask and @fragment, which now includes own_blurred, but removes sample_cursor. The generated shader therefore calls a missing function. The test also still uploads eight vec4s instead of eleven and compares against the old directional kernel. Update cursor_texture_edges.rs alongside this shader so the GPU test can compile, bind the larger uniforms, and compare the intended weights.

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/rendering/src/shaders/cursor.wgsl
Line: 235-241

Comment:
**Cursor GPU test breaks.** `reference_shader()` copies everything between `screen_bounds_mask` and `@fragment`, which now includes `own_blurred`, but removes `sample_cursor`. The generated shader therefore calls a missing function. The test also still uploads eight `vec4`s instead of eleven and compares against the old directional kernel. Update `cursor_texture_edges.rs` alongside this shader so the GPU test can compile, bind the larger uniforms, and compare the intended weights.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e02b8c8.

for (var i = 0; i < 13; i = i + 1) {
let percent = (f32(i) + dither) / 13.0;
let weight = 4.0 * (percent - percent * percent);
color += own_blurred(input.uv + ray_px * percent / cursor_size, velocity_uv) * weight;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Tilt turns the screen blur. The new screen offsets are measured in output pixels, but input.uv follows the rotated cursor. Adding screen_uv or ray_px / cursor_size directly makes the screen’s blur turn with the cursor. This happens during ordinary horizontal movement because cursor tilt is enabled by default. Convert screen offsets through the inverse of the vertex transform before adding them to input.uv, and use the same conversion when expanding the quad.

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/rendering/src/shaders/cursor.wgsl
Line: 282

Comment:
**Tilt turns the screen blur.** The new screen offsets are measured in output pixels, but `input.uv` follows the rotated cursor. Adding `screen_uv` or `ray_px / cursor_size` directly makes the screen’s blur turn with the cursor. This happens during ordinary horizontal movement because cursor tilt is enabled by default. Convert screen offsets through the inverse of the vertex transform before adding them to `input.uv`, and use the same conversion when expanding the quad.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e02b8c8.

Comment on lines +261 to +265
color = own_blurred(input.uv, velocity_uv) * 2.0;
for (var i = 1; i < 20; i = i + 1) {
color += own_blurred(input.uv + screen_uv * (f32(i) / 20.0), velocity_uv);
}
color /= 21.0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Screen edges cut cursor streaks. The new screen blur samples the cursor before clipping it to the card, then applies screen_bounds_mask to the finished blur. Near an edge, this cuts off the cursor’s streak where the screen’s streak continues. It can also pull a cropped-away cursor back into the card. Apply the card mask at each screen-blur tap, before averaging, rather than clipping the finished screen blur.

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/rendering/src/shaders/cursor.wgsl
Line: 261-265

Comment:
**Screen edges cut cursor streaks.** The new screen blur samples the cursor before clipping it to the card, then applies `screen_bounds_mask` to the finished blur. Near an edge, this cuts off the cursor’s streak where the screen’s streak continues. It can also pull a cropped-away cursor back into the card. Apply the card mask at each screen-blur tap, before averaging, rather than clipping the finished screen blur.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e02b8c8.

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found 3 potential issues (3 medium).

View 2 other findings in Capy.

Open in Capy

let screen_uv = screen_move_uv();
color = own_blurred(input.uv, velocity_uv) * 2.0;
for (var i = 1; i < 20; i = i + 1) {
color += own_blurred(input.uv + screen_uv * (f32(i) / 20.0), velocity_uv);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen panning is counted twice in the cursor blur

Medium Severity

At 60 fps and full blur strength, a cursor stationary relative to a card panning 30 px receives a 30 px velocity from frame_motion in CursorLayer::prepare. This branch then convolves that already-blurred sprite with the screen's same 30 px vector. The cursor therefore gets a roughly 57 px triangular smear while the display gets a 28.5 px directional smear, making the cursor trail farther and fade differently from the content beneath it. Apply the parent pan only once, either by retaining only relative cursor motion for the inner blur or by using a single combined kernel.

Open in Capy

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended. The cursor is drawn as part of the screen: its own blur follows how it moves on the frame (which includes the pan), and the screen's blur is then applied over everything on the screen, the cursor included. A cursor resting on a panning screen therefore gets both, which is the look we want; the test a_pan_smears_the_cursor_with_the_screen pins the first half.

Comment thread crates/rendering/src/lib.rs Resolved
…pped per tap

- Screen blur offsets go through the inverse of the cursor's vertex
  transform, so a tilted cursor no longer turns the screen's smear.
- Each screen tap is clipped to the card where it lands, so a streak near
  the card edge is not cut where the screen's continues.
- The cursor edge GPU test binds the larger uniforms and compares against
  the new tap spacing; the blur helpers sit after the entry point so its
  reference shader still builds.
@richiemcilroy

Copy link
Copy Markdown
Member Author

@greptileai review

@richiemcilroy

Copy link
Copy Markdown
Member Author

@greptileai review

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

Open in Capy

Comment on lines +5189 to +5194
let display_motion_delta = display_motion_delta.filter(|_| {
final_target_bounds
.iter()
.zip(base_target_bounds)
.all(|(placed, zoomed)| (placed - zoomed).abs() < 0.01)
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Transitions drop remaining pan blur. This filter removes all carried motion as soon as a split or text takeover changes the card bounds. During a partial transition, the card still follows part of the zoom’s pan through lerp_bounds, so that motion has not disappeared.

With cursor blur enabled and screen blur disabled, a cursor that stays still on the recording now gets no blur during that pan: prepare maps both cursor positions through the current display, and display_motion = None removes the only carried-motion term. Compute that term from the final card transform instead of dropping it for the whole transition.

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/rendering/src/lib.rs
Line: 5189-5194

Comment:
**Transitions drop remaining pan blur.** This filter removes all carried motion as soon as a split or text takeover changes the card bounds. During a partial transition, the card still follows part of the zoom’s pan through `lerp_bounds`, so that motion has not disappeared.

With cursor blur enabled and screen blur disabled, a cursor that stays still on the recording now gets no blur during that pan: `prepare` maps both cursor positions through the current display, and `display_motion = None` removes the only carried-motion term. Compute that term from the final card transform instead of dropping it for the whole transition.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

…mped new-project zoom

- The radial blur's taps run away from the zoom centre while the frame
  grows, so a zoom in smears behind the motion as a zoom out does,
  instead of ahead of it. The direction reaches the display, camera and
  cursor passes.
- New projects zoom with a critically damped spring: 50% in 123 ms and
  90% in 290 ms (was 139 / 312 ms), no overshoot. Saved projects keep
  their own spring.
@richiemcilroy

Copy link
Copy Markdown
Member Author

@greptileai review

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 2 other findings in Capy.

Open in Capy

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant