The next effect that we will look at builds on our Gaussian blur effect to recreate the "depth of field" effect. In the real world, cameras have one specific range they can focus clearly on, and everything outside of that range is blurred somewhat, getting increasingly blurry as the subjects move farther from the focal range. Generally, the effect isn't terribly noticeable, but in some cases it can be exaggerated intentionally for aesthetic effects.
The process is simple: First, we render the scene storing only the depth values in a depth map (like we did in Chapter 3 , Advanced Lighting). Then we render the scene normally, storing both the original render and a blurred version of it. Finally, we combine the blurred and non-blurred images in another post processor, which determines how much to blur the image based on the depths stored in the depth map at each pixel.
The effect that we will need to render the depth map is very simple, and we have seen most if not all of it before...