Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit65083fe8f2

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

namekind
scene_motiontexture2d
scene_depthtexture_depth
dilation_paramsbuffer (read, vec4<f32>)
dilated_outstorage2d (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.