Thursday, December 4, 2008

Jeff Russell Depth Of Field example

Depth of field came up on the gdalgorithms list. Jeff Russell caught the thread and replied with some screen shots from his brute force O(n^2*m^2) blur, with nice circles of confusion. I'm posting it here to make a few comments:

Sure, there are the typical DOF artifacts (halos, alpha object discontinuities, ...), but:
  • Top Left: Check out the trees, they look "right". The small highlights on leaves, or of sky through leaves, has that distinctive look that Gaussian blurs don't capture.
  • Center Left: Most of the scene is mush, but the enemies show distinctive disk highlights on points and lines.


  1. I'm really interested as how Jeff Russel achieved his effect. How does he sample the image? Does he use a kernel ?

  2. He claims to have used a straight forward kernel, with clipping for shapes:

    "Basic approach was to just do a 2d grid of samples about each point and use
    a little math to clip off the edges for various shapes: square, diamond,
    circle, and finally octagon which looks the best IMO. Some of these shapes
    (square, diamond) would be separable which would let it run pretty fast even
    on less than super hardware. If your image data isn't HDR, a simple color
    ramp help the highlights "pop" more for the purposes of the blur. All of
    this is very simple and has worked well."