Tell me more ×
Graphic Design Stack Exchange is a question and answer site for professional graphic designers and non-designers trying to do their own graphic design. It's 100% free, no registration required.

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?

share|improve this question
This seems more like a stack overflow question than graphic design. Also...can you blur just one pixel? – DA01 Apr 2 '12 at 22:10
I suspect the answer is dependent on the geometry of the camera you're modelling, and that a simple Gaussian blur doesn't cover it either. You would probably get better results on a technical 3d modelling site. – e100 Apr 3 '12 at 10:55

closed as off topic by DA01, Joonas, e100, Farray Apr 3 '12 at 15:45

Questions on Graphic Design Stack Exchange are expected to relate to graphic design within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

Browse other questions tagged or ask your own question.