Builtin Library
- ..
- README.md1.4 KB
- bindings.yaml250 B
- shader.wgsl2.9 KB
README.md
mv_dilate
Gives each texel the velocity of the closest surface within radius texels of
it, so a nearer moving object's velocity reaches that far out past its own
silhouette.
Depth is reversed-Z, so the closest surface is the greatest depth value. The
search starts from the texel's own surface, so a texel keeps its own velocity
unless a strictly nearer one is within reach. It covers the full (2r+1)²
square; a neighbour past the frame's edge resolves to the nearest texel inside,
so a border texel searches real velocity and real depth throughout.
Depth separates two surfaces only when both of them drew into it. A pass that lays velocity over the frame by coverage rather than by a depth write — a Gaussian splat cloud — leaves its texels reading the depth of the surface behind it, which puts the whole neighbourhood on one plane. At equal depth the faster velocity wins, so a surface the depth buffer cannot separate still reaches the pixels it is travelling into.
Bindings
| name | kind |
|---|---|
scene_motion | texture2d |
scene_depth | texture_depth |
dilation_params | buffer (read, vec4<f32>) |
dilated_out | storage2d (rgba16f) |
dilation_params[0].x is the radius in texels. dilated_out carries the
winning velocity in xy — rgba16f because a storage texture cannot be
declared two-channel.