In the world of computer generated cartoons and images, we have a very awesome trick we can do which cannot be done in real life. We can have unlimited Depth of Field. If you aren’t a photographer or involved in filming, you probably have no idea what that means. Well, in real life lenses cannot have everything in perfect focus from the front of the scene to the back. This is controlled by the f-stop. The bigger the f-stop, the more everything is in focus from front to back, the bigger the depth of field. Although, the f-stop is expressed as a fraction, so technically it is smaller numbers that are in higher focus. For example, f/2.8 will have your main character in focus and the rest of the background blurry. This is very useful in photography to force the viewer to focus primarily on your subject while having the background just provide some color. For a landscape image, a photographer may use f/11 to make sure that a large portion of the image is in focus.
Well, that’s a basic primer and you can look it up some more if you’re really interested. However, in computer animation, we are not dealing with real lenses so we can have infinite depth of field; in other words, everything is in focus. This is awesome because you don’t have to worry about f-stops and all that (and in real life there’s a trade-off as f/11 lets in less light than f/2.8 so you need more lights) and can just count on everything being in focus. However, this is not realistic and so you may want to be able to emulate it. The most recent version of Blender has simplified doing this. By the way, Disney simulated this for the first time in a feature film in The Lion King when you first see the ants in focus and then the animals going to Simba’s birth ceremony.
I was having some problems doing this in Blender and it took me a little while to figure out what I was doing wrong so here are the steps. First, select your camera, go to Editing, and edit the depth of focus distance. You’ll want to turn on limits so you can see where this depth of focus is going. Then you need to go to the node editor. Add->Filter->Defocus Then connect image in “RenderLayer” to Image in “Defocus”. Connect Defocus’ output image to the input image of “Composite”. Connect Z from “RenderLayer” to Z in Defocus. Now if you render, it will look like nothing happened! What the heck?
You need to go to Scene then click “Do Composite” under the “Anim” tab. Now render and after the render it will apply the filter. Yay!
Here are some examples from “Sugar” – to get the full effect you may want to click to get the full size render.
here’s the normal scene:
and here it is simulating f/2.8 – a common large depth of field:
Now, obviously there’s some more tweaking which could be done because the f/2.8 render is a bit too blurry around the character’s outline. But those are optimizations that you have to figure out on your own. I’m anxious to get back to work on other things and I’m not sure if I’m going to return to this in the future, but at least I know it’s there and I know how to do it so that I can play with it when it will help the mood of the film.