{"id":276,"date":"2008-12-06T02:19:23","date_gmt":"2008-12-06T08:19:23","guid":{"rendered":"http:\/\/www.mrbluesummers.com\/?page_id=276"},"modified":"2012-02-21T16:55:24","modified_gmt":"2012-02-21T16:55:24","slug":"depth-of-field-primer","status":"publish","type":"post","link":"http:\/\/www.mrbluesummers.com\/276\/3d-tutorials\/depth-of-field-primer","title":{"rendered":"Introduction to Depth of Field"},"content":{"rendered":"

Hello everyone!<\/p>\n

Today is a Friday. And on Friday I usually think about what I’m going to do for the Monday Movie that I promise to deliver in a few days. This week, however, I realized that Depth of Field is a topic that a) wouldn’t compress very well in YouTube, and b) deserves more than 10 minutes. Depth of field is one of the many things you can use in your renders to add realism, meaning, and style. Like a lot of other features of 3ds Max, depth of field (DOF) requires tact and care to make a convincing and elegant result.<\/p>\n

New: Take a look at my Depth of Field Monday Movie<\/a>!<\/strong><\/p>\n

<\/strong><\/p>\n

\"The<\/a><\/p>\n

The final render of the scene.<\/p>\n<\/div>\n

If you’ve ever done a lot of cooking you can relate to this. Everything tastes great with butter, salt, and pepper. I could serve you a fried brick and it would taste awesome! What separates the good chefs from the great ones is knowing when and how much fat to use to keep everything in balance.<\/p>\n

Let’s start with this image below.<\/p>\n

\"No<\/a><\/p>\n

Beginning image with no depth of field.<\/p>\n<\/div>\n

Depth of Field Scene Download<\/a><\/p>\n

You’ll notice that I didn’t use any depth of field at all. However, there are already a lot of visual clues that tip you off that these teapots aren’t huge. The scale of the materials (such as the wood on the floor) are reasonable for ordinary sized objects. The baseboards along the bottom of the wall in the background gives you another clue since those are rarely taller than a few inches. I’m not relying on depth of field to be<\/em> my scale queue, but instead to be a part of<\/em> the greater image.<\/p>\n

Mental Ray<\/h1>\n

Let’s add depth of field to this scene. The first thing to consider is what should be in focus. In most cases, it’ll depend on what’s most important. Below you’ll see two examples of renders with different focal points. In the left image, we’re focusing on the boy teapot and the heart, while in the right image we’re focusing on the girl teapot and what she sees.
\n

<\/p>\n\n\n\n
\n\n
\"Image<\/a><\/p>\n

Focus is on the nearest teapot.<\/p>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

<\/center>
\nI accomplished this effect quite easily. Instead of rendering with the perspective viewport, I hit Ctrl + C which is the default hotkey to create a camera in the active viewport. The camera thus created has a group called “Multi-Pass Effect” in the modify panel. When enabled, and set to “Depth of Field (mental ray)”, this setting will give you the depth-of-field effect. The way I shifted the focus of the shot was by changing the target range of the camera. This spinner is found just below the “Multi-Pass Effect” group. Try twiddling this spinner a bit, and you’ll see the camera’s “target” moving, indicating the distance at which objects will be in focus.<\/p>\n

Now you’ll notice that the effect is pretty strong in both images. This is because the f-stop is set to only 2.0 by default in 3d Studio Max. If you’ve taken photography classes or done photography tutorials, you can skip this paragraph. A camera’s f-stop is a measure of how large the camera’s aperture is, where smaller numbers mean a larger aperture. The aperture of a camera is how big the ‘eye’ of the camera is and it determines how much light to let in. Without going into the details, know that a smaller aperture (larger f-stop value) means more of the image will be in focus.<\/p>\n

As a visual demonstration, the three images below show differing f-stop values for the camera in this scene. To be explicit, each teapot is about 6″ in diameter.<\/p>\n\n\n\n
\n\n\n
\"\"<\/a><\/p>\n

A high f-stop.<\/p>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

These show varying degrees of blurring. The first image is so blurry we can’t see much of anything. The second image gives us an idea, but it’s still too muddy to make out what the scene is about. The final image makes gentle use of depth of field to convey scale and still make the scene’s objects clear.<\/p>\n

Below is a larger render of that third image. The effect is still a little too high for my taste, but I think you get the idea about using Depth of Field in 3ds Max with subtlety.<\/p>\n

\"The<\/a><\/p>\n

The final render of the scene.<\/p>\n<\/div>\n

Scanline<\/h1>\n
\"Scanline<\/a><\/p>\n

Scanline Depth of Field Settings<\/p>\n<\/div>\n

Now that you know how to create depth of field in mental ray, learning it in the scanline renderer is a breeze. Unfortunately, all of my materials were mental ray materials and my light was a mental ray light so I won’t be including quite as many pictures in this last section.<\/p>\n

There are several ways of setting up depth of field in the scanline renderer in 3d Studio Max. On the one hand, you could use a similar method as we used in the mental ray renderer version. You’ll create a camera using the Ctrl + C method or by creating one manually, and under the “Multi-Pass Effect” group you’ll enable the “Depth of Field” effect. When you render, however, you’ll notice that it uses a very primitive method for creating depth of field, and this is generally not recommended.<\/p>\n

In scanline your best bet is to use the render effect found in the environment and effects panel (hotkey ‘8’ and shown on the right with final values). Open this panel and click on the “Effects” tab. Under the “Effects” rollout, you can click “Add…” and select “Depth of Field” from the menu. You will now have to select your camera using the “Pick Cam.” button, as well as select the object you want to be in focus with the “Pick Node” button.<\/p>\n

If you render, you will now see that you have the depth of field effect, but it probably won’t be properly adjusted. You can alter the severity of the blurring effect by altering the focal parameters at the bottom of the Effects window. I’ve found that using the “Use Camera” mode and keeping horizontal and vertical losses equal works best (as shown).<\/p>\n

In the end, the scanline renderer is actually more complicated to use than the mental ray depth of field settings. I hope this primer has been of use to you, and helped to demystify depth of field in 3d Studio Max. Just remember; subtlety, rather than know how, is the key to using this tool to great effect!<\/p>\n

Until next time, happy rendering.<\/p>\n","protected":false},"excerpt":{"rendered":"

Hello everyone! Today is a Friday. And on Friday I usually think about what I’m going to do for the Monday Movie that I promise to deliver in a few days. This week, however, I realized that Depth of Field is a topic that a) wouldn’t compress very well in YouTube, and b) deserves more […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,111,20],"tags":[36,42,45,2569,2567,22,88],"_links":{"self":[{"href":"http:\/\/www.mrbluesummers.com\/wp-json\/wp\/v2\/posts\/276"}],"collection":[{"href":"http:\/\/www.mrbluesummers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.mrbluesummers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.mrbluesummers.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.mrbluesummers.com\/wp-json\/wp\/v2\/comments?post=276"}],"version-history":[{"count":0,"href":"http:\/\/www.mrbluesummers.com\/wp-json\/wp\/v2\/posts\/276\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.mrbluesummers.com\/wp-json\/wp\/v2\/media?parent=276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.mrbluesummers.com\/wp-json\/wp\/v2\/categories?post=276"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.mrbluesummers.com\/wp-json\/wp\/v2\/tags?post=276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}