In photography DOF(Depth Of Field) is the range in which the image blur is smaller than one pixel. That means that outside the DOF the image gets blurry.
As you might have already seen, I had a Blur Compute Shader implemented. So making a DOF is just a simple matter of doing blur adjusted to the depth of the pixel, right? Not really.
Doing DOF is more complex than I initially thought.
The first issue I encountered is that when I wanted to blur pixels, which are before the DOF, my blur wasn’t wide enough. I didn’t want to increase the kernel so I just sampled with steps of 2 pixels instead of 1.
That was simple enough but then I realized something else. Even though I was sampling wider and even though I was performing a blur there were still hard edges in areas with discontinuity.
What do I mean? Imagine you look behind…
View original post 147 more words