Motion Blur GL4/GLES3 Advanced Sample

Category:  Visuals
Min PC GPU: Fermi-based (GTX 4xx)
Min Tegra Device: Tegra K1


This sample shows a filtering method for simulating motion blur of fast-moving objects. The method used is a 2D full-screen post-process that works on a normal framebuffer augmented with a screen-space velocity buffer; thus, filtering performance is not dependent on scene geometric complexity. The algorithm is based on the paper 'A Reconstruction Filter for Plausible Motion Blur,' by McGuire et. al. (SIGGRAPH I3D'12)

APIs Used

Shared User Interface

The OpenGL samples all share a common app framework and certain user interface elements, centered around the "Tweakbar" panel on the left side of the screen, which lets you interactively control certain variables in each sample.

To show and hide the Tweakbar, simply click or touch the triangular button positioned in the top-left of the view.

Other controls are listed below:

Device Input Result
touch 1-Finger Drag Orbit-rotate the camera
2-Finger Drag Move up/down/left/right
2-Finger Pinch Scale the view
mouse Left-Button Drag Orbit-rotate the camera
Right-Button Drag Move up/down/left/right
Middle-Click Drag Scale the view (up:out, down:in)
keyboard Escape Quit the application
  Tab Toggle Tweakbar visibility
gamepad Start Toggle Tweakbar visibility
  Right Thumbstick Orbit-rotate the camera
  Left Thumbstick Move forward/backward. Slide left/right
  Left/Right Triggers Move up/down

Technical Details

This sample is an implementation of a plausible reconstruction filter for motion blur. It is a 2D multi-pass post-process implemented mostly in a GPU shader language, which has the following advantages over competing alternatives:

The algorithm takes the following as inputs:

Figure 1: Color buffer (Click to enlarge)

Figure 2: Depth buffer (Click to enlarge)

Figure 3: Half-velocity buffer (Click to enlarge)

Algorithm overview

Once the color buffer C, depth buffer Z and vertex half-velocity buffer V (all of size w and h) have been generated, the algorithm performs the following passes:

  1. TileMax(V):

Figure 4: TileMax pass output (Click to enlarge)

  1. NeighborMax(TileMax):

Figure 5: NeighborMax pass output (Click to enlarge)

  1. Final gathering (reconstruction) pass:

Figure 6: Final reconstruction pass output (Click to enlarge)

Using our sample implementation

In addition to the shared controls above, the following items have been added to the TweakBar:

Implementation details and observations

See Also

NVIDIA® GameWorks™ Documentation Rev. 1.0.200601 ©2014-2020. NVIDIA Corporation. All Rights Reserved.