Builtin Library
README.md
dilateVelocity
The render passes behind the VelocityDilation component and the
velocityDilation module.
Two passes at afterLighting, ordered after the last pass that writes velocity
and before every pass that reads it. The visibility raster and the opaque
surfaces it leaves out leave the buffer during the scene draw; a Gaussian splat cloud
lays its own displacement over it at afterLighting order 22, so the seam sits
past that and ahead of the earliest reader, a denoiser's history term at order
50.
mv_dilate reads @scene.motion and @scene.depth and writes, into a
screen-sized target of its own, a field where each texel carries the velocity of
the closest surface within the radius. Depth is what decides the winner: a
nearer moving object beats the background it is passing in front of, so its
velocity reaches out over the pixels it is about to cover rather than stopping
at its own silhouette.
The copy puts that field back over @scene.motion, with blend = "replace"
so the dilated value is what a reader finds. It is a separate pass because the
first reads the buffer it is rewriting, and a pass cannot sample the attachment
it renders into.
Everything downstream reads the dilated field with no change at its own call site: the buffer it already binds now answers differently near a silhouette.
The radius arrives through the dilation_params buffer, packed by the
velocityDilation module. The intermediate target is screen-sized, so it
follows a window resize.