Tuesday, July 10, 2012

Tutorial #3 - Understanding Depth Of Field and Camera Settings

So two weeks ago I posted about knowing your camera sensors sizes, and I wanted this to get you to look at your camera's information to understand the aspects of it. The focal length, the sensor size, and f/stop affects how your photo looks. If you were going to use a render in compilation with a photo (or video) you took, you'd want these settings to be as near as accurate as you could get.

I feel this is something that is really taken for granted in blender. Depth Of Field, it's overdone, or not used at all. Both of which can make your scene or render look really fake if you're not using it correctly. So after the break, I've put up a new video, that goes into the settings of the virtual camera to make you take a look at the depth of field you're using in your scene.

In photography, depth of field is affected by two major factors; Focal Length, and Aperture Size. Both of which you can control in blender. Of course, aperture size in real life, is generally affected by the amount of light in your scene. Depth of field is also affected by the focal point (focus), or distance (in blender), which it appears that blender does take this effect into consideration when rendering.

To think about focal length, is fairly simple, think of a zoom lens on a camera. The more zoom in a lens, the higher the focal length. This is a fairly high focal length render.

Focal Length: 63, Aperture: 0.03
A wide angle shot is a lower focal length, for example like a GoPro camera is wide angle. Here's an example of a wide angle render.
Focal Length: 16, Aperture: 0.03
A "normal" camera lens, or something you're more used to, isn't really "zoomed", or too much of a wide angle.
Focal Length: 32, Aperture: 0.03
When you're looking at the reference images above, these are all set with the sensor size of 32mm. Which is relative to a film camera, and digital cameras will have it's own sensor size, and is something you will want to play with for understanding the focal length in blender, compared to the zoom and focal length of your own camera.

But what I'm really trying to touch on here is how to use depth of field correctly in a scene. The aperture setting in blender really changes how this effect is brought out.

When working with a real lens, for example, a zoom lens will have a shallow depth of field. The aperture is set to 0.06 in this next render to show this shallow depth of field, which is double that of the previous.
Focal Length: 32, Aperature: 0.06
This forces a shallow depth of field, which brings the attention to the focal point, in this case the glass shards. It also takes away the importance of the mountain range in the background, by taking it out of focus.

But a wide angle lens would have a deeper depth of field, bringing nearly everything into focus. This is exaggerated in this render, with an aperture of 0.001, everything is in focus.
Focal Length: 32, Aperture: 0.001
Using depth of field incorrectly, like this, will cause the viewer to misinterpret size and distance. So it's something to keep in mind when doing renders. The mountains will look closer, and smaller just because it's in focus, with the glass shards in the foreground are also in focus.

When working with scenes of things in the distance, like mountain ranges, the focal length needs to be also taken into consideration. If you're trying to zoom into the mountains a shallow depth of field and high focal length will really emphasize this. The mountains are cut off, but you can see them in focus, while the nearer objects are out of focus.
Focal Length: 63, Aperture: 0.03
This next set is all with a distance of 120 in blender, to keep focus on the mountain range. Where you can see the detail of the mountain range and everything in the foreground is out of focus.

A wide angle would normally keep the distant objects more in focus, and generally has a deeper depth of field, but here I have the depth of field still pretty shallow, although it still emphasizes the effect, I think this is fairly accurate.
Focal Length: 8, Aperture: 0.03
Keeping in mind the depth of field, is a tough thing when working with real film, but is easy to manage in blender. The larger the aperture the shallower the depth of field.

I also wanted to touch on some other settings in blender:

First is the exposure setting. This isn't really relative to exposure of a real camera, in fact all this is, is a multiplier applied to all the emitters. Which can brighten your scene, but can create hot spots from world textures, and other already bright emitters.

Gaussian blur; is a setting that is really tough to get a defining point that is perfect. I use 0.7 to 1.0 for general lens blurring. 0.3 to 0.5 if an image is intended to be really sharp and appear computer generated. 1.1 to 1.3 is to give a heavy blur as if the lens is just pretty bad. This can help remove or accentuate pixel lines, caused by computer rendering.

And one final thing that I wanted to save for last!

Panorama mode:

I love panoramas, I can't deny it. This render is designed for a spherical panorama, which is different than panos that we normally take with photographs (cylindrical). Some software can use this final render to give an "explore" or "world" view into your 3D scene.

Panorama mode, removes focal length and aperture, and just takes a spherical projected view of the scene into the frame. Basically everything is in focus. Where you can see the edges of the materials in my scene.

This can also be used if you're wanting to work with the sky and generate world skies in blender, that you can save for later use in other software or other renders.

I'll go into detail on how I did this sky effect, later this week. It's fairly simple, but a great effect, that you don't have to rely on your own photos, or paying for high definition world skies.

But if you do want real world skies, you can get some good quality ones from the great folks at http://www.cgskies.com

I hope this explained how to use focus and depth of field in blender, so you can accurately create a good render with proper focus, for your scene.

Remember these tips:
Zoomed Lenses = High Focal Length + Shallow Depth of Field
Wider Angle Lenses = Low Focal Length + Deep Depth of Field
Average Lens = Medium Focal Length (closer to the Sensor Size) + Depth of Field is dependent on light.
Dark Scenes, normally are deeper in depth of field.
Brighter Scenes, can have a shallower depth of field.

If you have any questions, or if I missed something let me know.

-Austere Grim


  1. What a nice tutorial about understanding the depth of field of the camera. I can use this technique in my photos hoot next week. I think it is Safety Technology to begin with.

  2. Definitely one of the better tutorials on camera settings and DOF. Thanks much Austere. Like you, I'm a huge fan of panoramics as well. I'm confidant that I know my way around a physical camera's settings. But 3D applications are sometimes a different story. Thanks for the informative article on manipulating the camera in Blender.