I have a depthbuffer of every pixel on the screen. From this, I compute the average depth of each pixel and call this my "focus" distance (This may pop up as another question, how to find the subject's distance from a depthbuffer (so you don't focus on the background/foreground)).
Anyway, then for each pixel I compute its "offset" from the desired focus distance, by running it through thisPixelsDistance / averageDistance. I then run it through a function f to find how much to blur the pixel. I then do a Gaussian blur on that pixel of width of the result from f and apply the results.
My question is this- What is the proper, real-world function f? Right now I'm using Math.Abs(Math.Log(x)), who's graph is view-able on google- abs(ln(x)) Another option is the same thing squared, which gives a smoother result. But what is the real world function?