I’m implementing DoF with separable gaussian blur. The
radius of the CoC (derived from depth buffer) maps to
width of the blur kernel, therefore I have variable sized
blurs per pixel. If the pixel is in focus, I skip the blur.
Notice that I’ve solved the ‘halo effect’ for the image
in focus (pink flower in middle): its edge remains sharp.
I do this by checking each sample’s Z during blurring
against the in focus Z-range. If the sample falls inside
this range (i.e. inside the DoF), then it doesn’t
contribute to the blur. In other words, I do a check for
every sample inside the blur kernel, adjusting the
normalising divisor accordingly.
Here’s the problem: the edge of the image (orange flower)
that is in front of the focused image is also sharp.
It should be blurred and there should be ‘pixel bleeding’
into the focused image. The front-most small image (red
flower) shows the desired effect on the edges. Any ideas?
Thanks in advance!