This was a demo written in C++/OpenGL that featured the following 3D effects:
- Motion Blur
- Depth of Field
- Full-Screen Anti-Aliasing
- Temporal Anti-Aliasing
The first three effects are usually achieved by sampling the scene multiple times for each frame,
which can be quite expensive. This demo, however, makes sure that an optimal number of frames per
second is achieved by taking only as many samples as possible without skipping frames.
The idea stems from the fact that in some cases your graphics card is able to render more frames per
second than your screen's refresh rate can show you. What the technique used in this demo does, then,
is make use of these extra "hidden" frames, to give you a better quality picture when the screen actually
does refresh. In addition, each sample is used for every effect at the same time.
Depth of field (shown above) simulates the way a camera lens or retina can only focus properly on a
single point, the objects in front of or behind it appear blurred. In the above picture, the leftmost
box has the focus. This depth of field effect is physically correct, unlike the pixel shader blur that
is often applied in modern games.
Motion blur (shown above) makes animation look much smoother. In the above picture the camera is moving
towards the boxes at high speed. One of the traditional flaws of real time 3D graphics is that each frame only
represents a single point in time. For the animation to look smooth one therefore needs to render a large
amount of frames (typically 60 per second). The reason why movies can run smoothly at 24 frames per second is that
movie cameras do not capture a point in time for each image, but rather they integrate it over 1/24th of
a second. The effect is what is called "motion blur".
Anti-Aliasing makes the image look less pixelated by taking multiple color samples per pixel. This is usually
done by the graphics card using specialized hardware, but in this case we get it for free with the other effects
at no additional performance cost.
The better your hardware, the more samples can be rendered between two refreshes,
and the better these three effects will look!
Temporal Anti-Aliasing is like regular AA except that the samples are taken over multiple frames.
If the framerate is high enough the eye is fooled and the desired effect is still achieved. In
the demo, temporal AA occurs when too few samples can be rendered between refreshes for regular AA
to be possible.
Temporal depth of field is possible but not practical since the area concerned is much greater
than the single pixels of anti-aliasing, and the "flickering" is therefore noticeable.