Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Many photographers use depth of field to add interest to a scene. Now what depth of field does is blur certain parts of the scene and leave other parts in focus. And it's a great way to draw interest to certain parts of an image. It's used a lot in photography, so your subject is in focus and the background is blurred. Now we can do the same photographic effect in Maya using several different techniques. Now probably the easiest technique is to use the Depth of Field that's attached to every camera in Maya.
Now this works for both the Maya, Software Renderer and mental ray, but I'm going to use the Maya Software Renderer for this one. So let's take a look at our scene. So we have this basic scene with some cubes and then some cylinders, and then some more cylinders in the background. So if we render, we'll see that everything is sharp and in focus. But let's say we wanted to blur out parts of the image and only leave other parts in focus. We can do that using Depth of Field. So we find it in our camera.
So we go to View > Camera Attribute Editor in the window of our camera and if we do that, you can scroll down here, and you'll find a Depth of Field setting, great! So if I turn this on, it works, but we need to set some parameters. This first parameter is probably the most important. It's called Focus Distance, and that is where in the scene are we focusing. On what object, but more specifically at which distance from the camera are we focusing.
Okay, the next one is F Stop, and anybody familiar with photography knows that F Stop is basically how open or closed the lens is. So the more open the lens, the lower the F Stop, and the lower the F Stop, the more Depth of Field. So the more you close down the lens, the closer it gets to becoming a pinhole camera and the more infinite focus you get. So higher F Stops, sharper images, better focus. Lower F Stop, more Depth of Field, blurrier backgrounds, okay? Now the third one is just a Maya parameter, and this is Focus Region Scale and basically what it does is it amplifies or reduces the effect.
So if I bring this number large, it basically amplifies the amount of focus I have in the scene. So higher numbers mean more focus, less blurring. Lower numbers, less focus, more blurring, okay. So let's go ahead and just play with some of these parameters. The first thing we need to do is figure out where the heck in the scene are we focusing. So what we need to do is come up with a number that tells where in the scene we're focusing. Well, first of all let's take a look at our scene and say well, where in this scene do we want to focus? Well, let's go ahead and focus in the middle here.
Let's focus on this red cylinder. Now if I look the scene from the top, you could see that well, I've got my cameras here and my cylinders here. Well, I see I can put a ruler up to the screen. How do I measure this? Well, there's actually a very easy way to measure this in Maya, where you don't have to do much math at all except remember a number, and that is using what's called the Heads Up Display. So all we have to do is bring our viewport forward, and then under Display we have something called the Heads Up Display, and what this does is it actually allows you to turn on or off basically any one of these parameters.
So, for example, right now, we can see the name of the camera, which is Camera1, we can see the View Axis right here, and we can see some other stuff. But what I want to turn on is Object Details, and when I do that it brings up all of this information about my object. So whatever object I select, it tells me-- probably the most important one is how far away from the camera it is. So Distance from Samera, this thing is 57 units away from the camera.
This cube is only 30.9 units away. This red cylinder is 41 units away, so that's the number we need is 41. So I'm going to go back into my Camera Attribute Editor and in Focus Distance I'm just going to type that number, 41 and if I want to get real accurate, I can do 41.048, so I can make it exactly the right number. So when I do that, it's going to be exactly focused on the center of that cylinder, wherever the pivot point of that cylinder is.
So now that I have these numbers, let's do a quick render and see what we get. Not bad! Okay, so this is in focus, this is out of focus, and the stuff towards the back is gradually out of focus. So we can also play with some of the parameters. So, for example, if we take our F Stop, and let's go ahead and make it much bigger. Let's go ahead up to say something like 16. When we do that, you can see that well, more things are in focus. Because again, higher F Stops, better focus.
Well, let's do the opposite. Let's bring this down, so probably the biggest widest lens you can buy is a 1.2. So let's go F Stop of 1.2, open the lens as wide as possible. Now also notice that this takes longer to render, because you have more blurring and has more stuff to calculate. So again, you're getting a lot more blurring here. So let's go ahead and just put this towards a middle number. Let's say F8. That gave me a little bit of blur. Now what we can do is we can also play with this Focus Region Scale. So if we brought it down to say .25, so going from 1 to .25 should quadruple the amount of blurring or basically reduce the focus area by a fourth and again we get more blurring.
So if we bring this up, let's say we'll bring it up to 4. So again, we're now expanding that so we have more stuff in focus and you can see, well, we get very little blurring around the edges here and most of it is in focus. So this is probably the easiest way to get depth of field and it works in both the Maya Software Renderer and mental ray. Now there are more sophisticated ways to get Depth of Field using mental ray, but for just the basic down and dirty depth of field, this is a great way to work.
Get unlimited access to all courses for just $25/month.Become a member
107 Video lessons · 31712 Viewers
90 Video lessons · 21976 Viewers
78 Video lessons · 8054 Viewers
83 Video lessons · 7757 Viewers