The shader code is in the paper, so no code sample is necessary to
implement this paper. However, we will probably release a demo
program later when our production schedule permits.
See Simon Green's GDC 12 talk for examples of our motion blur algorithm in the Unity DX11
demo.
Eric Lengyel's article
on Motion Blur and the
Velocity-Depth-Gradient Buffer in Game Engine Gems describes two
ideas for any post-processed motion blur that are compatible with our
algorithm. The first is a method for choosing the depth-test
discrimination threshold based on the local depth gradient and
distance from the camera. Our "soft" depth comparison is an
alternative that saves two texture channels at the expense of accuracy
on slanted blurry pixels; the results are indistinguishable and the
derivative could be computed on the fly, so either method is probably
equally good. His second idea is to divide the screen into tiles and
flag tiles near dynamic objects. Unflagged tiles receive a
less-expensive motion blur algorithm that only considers camera motion
and has no depth test. Flagged tiles receive the full shading. This
improves performance at a small loss in quality for the unflagged
tiles. We recommend considering this as an extension of our
algorithm. So long as the tile boundaries are not revealed by the loss
of depth testing (which depends on your scene and tile size), this can
nicely speed up the blur pass, and the NeighborMax buffer is an
obvious place to store the flags.
At the suggestion of the reviewers, we added the vector fields over
the velocity images at the last moment before publishing the paper.
We've since noticed that when we exported the velocity fields from our
programs to PNG images, some of the values were clamped in the
process. This didn't matter for viewing the RGB images but produced a
slightly incorrect visualization of the vector lines for large
velocities, e.g., the dragon's wings are primarily moving up and down
in the teaser, but clamping the Y velocity left the X velocity
relatively too large.