Distance depth of field
Depth of field, or DOF for short, is a postprocessing technique which emulates lens out of focus. Any lens including the one in our eyes can't focus on the full visible distant range. Up to this point, every pixel in the scene was always rendered in focus regardless of its distance. In this recipe, we will be adding a very simple DOF for far distant objects. This DOF implementation runs very fast and should be used to emulate out of focus towards the end of the visible range.
Getting ready…
We won't need to allocate any new assets for this recipe. For depth sampling, reuse the same depth shader resource view we used for deferred shading. Both projection parameters used to convert ZBuffer depth values to linear range are the same as the ones used for deferred lighting.
How to do it...
All the changes for this recipe will be in the final pass pixel shader. We will be sampling both the downscaled and the depth textures. With those additional textures, the texture deceleration...