Posted 11 November 2012 - 01:21 AM
Honestly though I'm not sure that frequency domain is really so great for DOF. FFT is certainly not free, so you generally need to be using a really wide filter for it to be worth the cost of converting to and from the frequency domain. Plus FFT needs to work on power-of-2 dimensions, so you need to deal with that. However the biggest problem is that for a filter-based DOF to look decent you need the ability to not filter across depth discontinuities, in order to avoid background bleeding onto the foreground and other similar artifacts. This isn't simple to do in the frequency domain. Plus you really want to vary the kernel size per pixel based on the depth, which also isn't simple.
As the above poster mentioned you need to convert your kernel to the frequency domain using an FFT, after which you can convolve your kernel with the source image by performing a complex multiply of image * kernel for each pixel. You have to be careful though when using a cyclic FFT (such as the one used in the CUDA FFT library), since it means you need to cyclically shift your kernel.