Repository navigation
Blur the cursor with the screen and centre zoom blur on the zoom origin - #4417
richiemcilroy wants to merge 5 commits into
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Sandchest reviewed Sandchest reviews every change for vulnerabilities an attacker could use · 1 credit · Review details |
|
@greptileai review |
| 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)); |
There was a problem hiding this 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 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.| 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; |
There was a problem hiding this 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.
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.| 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; |
There was a problem hiding this 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.
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.| 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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
…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.
|
@greptileai review |
…takeover moves the card
|
@greptileai review |
| let display_motion_delta = display_motion_delta.filter(|_| { | ||
| final_target_bounds | ||
| .iter() | ||
| .zip(base_target_bounds) | ||
| .all(|(placed, zoomed)| (placed - zoomed).abs() < 0.01) | ||
| }); |
There was a problem hiding this 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.
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.…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.
|
@greptileai review |

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
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.t = 0, 0, 1/20 ... 19/20along 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.

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

Testing
cargo test -p cap-rendering --lib: 566 pass, 5 new:cargo test -p cap-rendering(every target), including the cursor edge GPU test, which now checks the new tap spacing.cap-rendering.

Confidence Score: 5/5
The PR appears safe to merge, with the existing non-blocking transition blur issue still open.Findings
Fix with agent prompt
Summary
The PR makes the cursor share the screen’s motion blur and centres zoom blur on the point the frame scales about.
Reviews (8) · Last reviewed commit: "fix(rendering): zoom-in blur trails the ..." · Reviewed by Greptile