Creating Depth-of-Field in Cinema 4D, Nuke, & After Effects

Want to add realism to your 3D renders? Then you're going to need to add some depth of field. In this tutorial you'll learn about the two most common methods of creating a depth-of-field effect on your renders. We'll start by setting up a scene in Cinema 4D to have both in camera depth of field in your final render, and also how to get depth of field by using passes that you can composite in After Effects or Nuke.

If you have any questions, click over to the Q&A tab to post them. Other students can answer you, and we'll put our team on the case to try and get you a solution ASAP. 

    00:00:00,000(bottle rocket whirring)
    00:00:00,833(pen bouncing)
    00:00:01,671(upbeat music)
    00:00:07,853(birds chirping)
    00:00:11,218- Hey there. (upbeat music)
    00:00:12,051Joey here for School of Motion,
    00:00:13,108and in this lesson we are going to take a look
    00:00:14,958at how to create depth of field in your 3D renders.
    00:00:18,368This is a very important technique to know
    00:00:20,915for adding realism to your composites.
    00:00:23,095We'll take a look at the pros and cons
    00:00:24,902of two different ways of achieving this effect,
    00:00:27,535by baking the depth of field into your render,
    00:00:30,005and by rendering out a separate pass
    00:00:32,062that you can use in your favorite compositing software.
    00:00:34,942Don't forget to sign up for a free student account
    00:00:37,166so you can grab the project files from this lesson,
    00:00:39,466as well as assets from any other lesson
    00:00:42,052on School of Motion, and now let's jump in.
    00:00:45,394So here we are in Cinema, and I have just set up
    00:00:49,421a really, really simple scene with these
    00:00:53,578nine objects kind of arranged in a grid,
    00:00:57,690and I did that just so we had something to,
    00:01:01,720something that could be a foreground,
    00:01:03,450and the background, and it'd be easy to
    00:01:05,219show you guys depth of field.
    00:01:08,274So, if we look at this render here
    00:01:12,098through the editor camera, you can see
    00:01:15,343there's no depth of field.
    00:01:16,192It looks very synthetic, very CG.
    00:01:18,655So, a lot a times to help with that,
    00:01:21,409we use depth of field, and if you're not
    00:01:24,327completely familiar with depth of field,
    00:01:26,468depth of field is that effect you get
    00:01:29,426when you take a picture with a camera,
    00:01:31,974for example, and you're focused on something far away,
    00:01:36,866but in between you and your subject,
    00:01:39,125there's something close to the camera,
    00:01:40,565and that thing gets blurry.
    00:01:42,907It goes out of focus.
    00:01:44,179So, that's depth of field, and what depth of field,
    00:01:46,604what the words depth of field are referring to
    00:01:50,341are actually the region that is in focus in your image.
    00:01:57,077So, if you have a very narrow, a very narrow piece
    00:02:02,830of your image that's in focus, that's called
    00:02:04,764having shallow depth of field, and a lot of people
    00:02:08,630try to go for that effect, because it's cool looking,
    00:02:11,506and it can make things look like you're
    00:02:14,873really, really close to them, or they're
    00:02:16,940really, really small and you can get a lot of neat effects.
    00:02:20,425So anyway, to get depth of field from Cinema,
    00:02:26,298the first way I'm gonna show you guys
    00:02:27,960is to create a depth pass, and then composite with that.
    00:02:31,909So, the first thing you need to do to create a depth pass
    00:02:35,904is enable multi-pass rendering,
    00:02:39,022and enable the depth channel, and I've already
    00:02:41,778done that here, but I'm gonna erase this
    00:02:43,583and just show you guys.
    00:02:44,699So, I went to my render settings,
    00:02:47,656and I made sure multi-pass is checked,
    00:02:51,510and what I'm gonna do really quickly
    00:02:54,240is I'm going to go into my save settings,
    00:02:57,114and I'm going to erase the file name here
    00:03:02,665so that I can use my picture viewer,
    00:03:04,968but not actually save a file,
    00:03:07,321and that's a trick I like to use a lot.
    00:03:09,822So, then we have our multi-pass checked.
    00:03:11,631So, that's enabled, and we're gonna click
    00:03:14,297on the multi-pass tab, go down here
    00:03:16,760and add the depth channel.
    00:03:17,950So now when you render your scene
    00:03:20,287you're gonna get the depth pass.
    00:03:22,634Now, let's add a camera.
    00:03:26,376Alright, and a lot of times, if you don't know
    00:03:30,859a lot about photography or cinematography,
    00:03:34,022and I don't know that much, but I have some experience
    00:03:37,066with it, and I find it helpful, because it's easy
    00:03:40,853to overdo it with depth of field, and add too much,
    00:03:44,184just because it looks neat, but if you're trying
    00:03:46,855to make things look real, or maybe not look real,
    00:03:49,937but feel like they were shot, then you don't
    00:03:52,992want to overdo it, and you want to have a sense
    00:03:55,738of what's the appropriate amount of blur
    00:03:58,736to have on your image, and in general longer lenses,
    00:04:03,102meaning lenses with a higher focal length,
    00:04:06,982they are gonna give you more depth of field,
    00:04:09,123because their focus is a little shallower.
    00:04:13,391It's a little narrower.
    00:04:15,433So, in general, a wider lens, and right now
    00:04:19,341I have this set to a 35 millimeter lens,
    00:04:24,079a 35 millimeter lens is not got gonna have
    00:04:25,974as much depth of field.
    00:04:27,041If we took, if this was a picture that we were taking,
    00:04:31,603we wouldn't expect to have a lot of blur in this image.
    00:04:35,050However, if we came in here, and took this picture,
    00:04:40,882you know the closer you get to an object,
    00:04:45,192the more out of focus it will be.
    00:04:48,648Let's say we're focused on this object in the center here.
    00:04:52,872This cube is gonna be a little bit out of focus.
    00:04:55,263So, I'm gonna, I'm just gonna set up a framing here
    00:04:57,567that's gonna give us a nicer range of things
    00:05:00,769to focus on, or not to focus on.
    00:05:03,775Alright, so let's try this.
    00:05:05,419Alright, so this is the render with no depth of field.
    00:05:08,911Now, if I send this to the render viewer,
    00:05:12,502just hitting shift R or clicking send to picture viewer
    00:05:17,187right here, by default your picture viewer
    00:05:22,283is gonna be set up to show you the image,
    00:05:25,193and you'll see that there is a depth pass,
    00:05:27,285but you won't be able to look at it.
    00:05:29,669If you change this to single pass mode,
    00:05:32,914now you can look right at your depth channel,
    00:05:35,215and right now it looks a little strange.
    00:05:38,666The background, which is just a sky object, is black.
    00:05:44,583All of my objects are white, and then I've got
    00:05:47,709this kind of gradient fading off into the distance.
    00:05:50,132Okay, now the way a depth channel,
    00:05:53,207a depth pass is supposed to work is that
    00:05:56,746things that you want in focus will be black.
    00:06:03,278Things that you don't want in focus will slowly
    00:06:05,463fade to white.
    00:06:07,923Another way to use a depth pass, and this is the way
    00:06:10,185I'm actually gonna show you is you can
    00:06:12,940simply make a gradient through your scene
    00:06:15,860where things that are close to the camera are black.
    00:06:18,451Things that are far away are white,
    00:06:21,119and then you can choose what's in focus later
    00:06:24,856in After Effects or Nuke.
    00:06:27,694So, the first thing we need to do is get
    00:06:29,633this depth pass to look right.
    00:06:31,111We need this cube to be fairly black,
    00:06:37,230and then we need all this stuff behind it,
    00:06:39,818this little pyramid, and this bucky-ball,
    00:06:42,250we need those to be white in our depth pass,
    00:06:47,518and then the background should be all white,
    00:06:50,237because it's really far away.
    00:06:52,166So, the way you do that in Cinema
    00:06:54,589is you actually set that up in your camera.
    00:06:58,136So, what I'm gonna show you is if we
    00:07:00,154click on the camera, come down here to focus distance.
    00:07:03,773Right now it's set to 2,000 centimeters,
    00:07:06,028which, as you can see, it's focused way back here,
    00:07:09,525not even close to our object.
    00:07:10,916So, I'm just gonna click, and that is not the right handle.
    00:07:15,594Let me fix that.
    00:07:18,272I'm gonna click and drag all the way back
    00:07:22,263so now we're focused just on that front cube, alright,
    00:07:28,003and if I send that to the picture viewer now,
    00:07:31,661our depth pass still doesn't look that great,
    00:07:34,992and that's because, that's basically because
    00:07:39,388right now Cinema's only calculating a depth pass
    00:07:43,864from the start of the camera to this.
    00:07:47,121So, if I scoot this all the way back like this,
    00:07:54,110oh and another stupid thing that I'm doing
    00:07:56,488is I'm not actually looking through the camera.
    00:07:58,300That's why that didn't change.
    00:08:00,352Let's actually look through the camera and render that.
    00:08:04,171There we go.
    00:08:06,538Alright, so now we're starting to get something
    00:08:08,763resembling a usable depth pass.
    00:08:12,499Now, the problem is everything's very dark,
    00:08:14,966and your depth pass will work best
    00:08:18,828if you have a good range of values to pick from.
    00:08:23,429You know, this color is very close to this color.
    00:08:26,838So, it's gonna be tough to really differentiate
    00:08:31,628in After Effects or in Nuke which part of the image
    00:08:35,526should be in focus.
    00:08:38,234Now, let's scoot in close.
    00:08:39,509Let's frame this back up the way we wanted it.
    00:08:45,802Okay, so now if I take the focus
    00:08:51,265of the camera back, pretend that we want just
    00:08:54,768this cube to be in focus.
    00:08:57,226Again, you're seeing that now our depth pass is black.
    00:08:59,613So, one of the things that it took me
    00:09:02,617awhile to figure this out, and I never really,
    00:09:06,413I never found a nice, concise tutorial explaining it.
    00:09:10,093So, here it is.
    00:09:12,180This is the trick.
    00:09:13,246You take your camera, you set the focus distance
    00:09:17,768to just before the very first object in your scene
    00:09:24,336that you'd like to control.
    00:09:26,889Then, go to details, and by the way I'm on Cinema 4D R13.
    00:09:33,055I think these were in a slightly different position
    00:09:36,560on the camera object in R12, and I've never used R14.
    00:09:41,014So, I'm assuming that they're called something similar,
    00:09:43,984but what you're looking for is the rear blur,
    00:09:47,198and if you enable the rear blur, you now get
    00:09:49,921a second sort of fainter set of lines
    00:09:52,647coming up from the camera, and I'm just gonna
    00:09:54,913bring those way back to 200, and you want to
    00:09:57,791position the rear blur just behind the last object
    00:10:02,071in your scene that you want to be able to control
    00:10:04,827the focus on.
    00:10:06,799Alright, so your actual focus is in front of the objects,
    00:10:11,000and your rear blur is behind them.
    00:10:14,381So, now if we render our depth pass, there we go.
    00:10:18,133This is what we want.
    00:10:19,200This cube that's very close to us is almost black.
    00:10:23,573Everything else fades to white in the background.
    00:10:25,464It's totally white, because it's really far away.
    00:10:28,036So, this is the exact depth pass that we want.
    00:10:32,204Now, I want to talk a little bit about
    00:10:34,116what these values are actually doing.
    00:10:37,392Let's say that we know that these three
    00:10:43,098back objects here are never going to be in focus.
    00:10:46,719We could pull this rear blur back to here,
    00:10:49,644and now if we look at our depth pass,
    00:10:52,313you'll see that that back row has disappeared,
    00:10:55,066because this is the maximum distance that we're
    00:10:59,756gonna be able to control with focus.
    00:11:02,917Now, and so what it does is it basically compresses
    00:11:06,166the black to white gradient so that you get
    00:11:10,658more values in between your front and your
    00:11:14,168back of your image, and when you're using
    00:11:17,125a depth pass, the more, the tighter you can keep that range,
    00:11:24,119the easier it's gonna be to control,
    00:11:25,944because there's only so many values between black and white,
    00:11:30,027and what'll happen is if your values are too close together
    00:11:33,761you're gonna get banding, and you can even
    00:11:35,783start to see it a little bit in this image.
    00:11:38,000I don't know how it's gonna look on the screen capture,
    00:11:39,637but I can actually see some color banding here,
    00:11:43,787and even if you render in 32 bit you're still
    00:11:45,957gonna get some color banding when you
    00:11:47,978have these values that are very close together.
    00:11:50,124So, you're best bet is always to try and get
    00:11:52,512the maximum contrast.
    00:11:54,195So, if you know you don't ever need these to be in focus,
    00:11:57,211then you don't need to include them in your depth pass,
    00:11:59,881but we don't know that.
    00:12:01,319So, we're gonna create a depth with these settings.
    00:12:05,688Okay, so now we need to render this,
    00:12:09,263and I'll show you how to composite this.
    00:12:11,941So, I'm gonna go to my render settings,
    00:12:13,344and I'm going to set up a new folder here,
    00:12:18,981and I'm just gonna call this image,
    00:12:23,273and then I usually just copy and past a file name
    00:12:26,580down here into the multi-pass image,
    00:12:28,712and I'll put underscore MP for multi-pass.
    00:12:32,246Now, I'm rendering open EXRs for my regular image,
    00:12:37,522and I'm going to render PNGs for my multi-pass.
    00:12:43,085You can use open EXRs for your multi-pass, also.
    00:12:51,069After Effects sometimes does funny things with EXRs.
    00:12:53,864So, when I'm using After Effects, I'll use PNGs.
    00:12:57,251When I'm using Nuke, I always use EXRs.
    00:13:00,844Alright, so now I've got this set up.
    00:13:02,455I'm gonna hit render, and we've got our image,
    00:13:07,357and our depth pass, and they are rendered.
    00:13:10,407So now let's switch over to After Effects,
    00:13:12,794and let's import those.
    00:13:16,865Okay, now in After Effects the most common
    00:13:22,705plugin that people use to create depth of field
    00:13:26,334is called Frischluft Lenscare, and here it is,
    00:13:32,011and it comes with two plugins, depth of field
    00:13:34,396and out of focus, and the one we want is depth of field.
    00:13:36,984So now the depth of field effect is a blur,
    00:13:40,352but the blur needs a depth layer to drive it.
    00:13:44,144So, we bring in our depth pass, which you can see is here,
    00:13:49,370and I'm just gonna rename this depth,
    00:13:53,739and I'm gonna turn it off, 'cause you don't need to see it.
    00:13:56,662So now our Frischluft effect, where it's asking
    00:13:59,966for the depth layer we point it to depth,
    00:14:02,800and now we're set up.
    00:14:04,524So, what I usually like to do with this plugin is first go
    00:14:08,401to change where it says show.
    00:14:12,600Change this to sharp zone.
    00:14:17,487Alright, what this is gonna do is gonna bring up
    00:14:20,085this sort of white fade over the image,
    00:14:26,214but if we crank up the radius a little bit,
    00:14:28,641you'll see it start to change.
    00:14:30,364What this is doing is it's showing us what part of
    00:14:33,249the image we're focusing on, and you can actually
    00:14:35,589use this select depth option here,
    00:14:37,880and just click where you want it to be in focus.
    00:14:41,874So now as soon as I click that cube,
    00:14:43,601that cube and a few things behind it became highlighted.
    00:14:48,592That means that they're in my focus zone,
    00:14:52,458and so this will be perfectly in focus.
    00:14:54,932This'll be a little bit out of focus,
    00:14:57,155and everything that's not highlighted
    00:14:58,556will be totally out of focus,
    00:15:00,371and if I change the radius of the effect,
    00:15:03,374it's sort of tightens up, it makes my depth of field
    00:15:08,638shallower, tightens it up, and that also is going to
    00:15:12,393increase the blur on the areas that are not in focus.
    00:15:15,843So, to start with, let's leave this pretty low.
    00:15:18,985Alright, and now we can switch back from depth,
    00:15:22,618sorry, from sharp zone to normal blur,
    00:15:26,487and you'll see that we now have some depth of field,
    00:15:29,438and it's very, very little right now,
    00:15:31,902but if I crank this radius up to say five,
    00:15:35,922you can see that we're starting to get
    00:15:38,395this background a lot more out of focus,
    00:15:40,916and you can crank this up pretty high,
    00:15:44,617and we can, and actually you can interactively
    00:15:47,176kinda move this point around,
    00:15:49,443and focus on different things, which is cool.
    00:15:52,038Alright, so if we're focused on the point of this cube,
    00:15:56,358everything else falls out of focus, and this actually
    00:16:00,663is pretty, you know, this isn't a bad result.
    00:16:03,908Now, the problem with this approach comes when
    00:16:09,379you want to focus on these back objects.
    00:16:12,872So, if we move this control and want to look at this ball.
    00:16:17,984Alright, so here's the problem.
    00:16:19,347Now this cube is out of focus as it should be.
    00:16:21,863However, right at the border where the two objects meet
    00:16:26,484it's not out of focus, and if we really start
    00:16:31,093cranking this up, then what you'll see is
    00:16:34,643you're gonna start getting these weird artifacts
    00:16:37,478all over your image, and that is happening
    00:16:41,766because in reality when you take a photo of something,
    00:16:46,500and something's out of focus, you can kinda see
    00:16:50,256the object behind your out of focus object,
    00:16:54,369and the edges of your out of focus object are soft,
    00:16:57,407and so you see detail through them.
    00:17:00,233So in order to actually know what you're seeing
    00:17:03,645through an object, you have to have the information
    00:17:06,028about that object.
    00:17:07,424So, this cube should be blurry out to about here,
    00:17:11,604and we should see the blue ball behind it.
    00:17:14,483However, we don't actually have both the information
    00:17:19,209about this yellow cube and what's behind it.
    00:17:22,384We only have a 2D image here.
    00:17:24,572So, when you start to make this really, really blurry
    00:17:29,791the whole thing starts to fall apart pretty quickly.
    00:17:33,170So, using a depth pass in this way,
    00:17:37,448it's only effective in certain situations.
    00:17:42,853It works best if the thing you're focused on
    00:17:46,563is the closest thing to the camera, and everything
    00:17:50,256behind it can be out of focus, and if anything
    00:17:53,021in front of it is gonna be out of focus,
    00:17:55,493you don't want it to overlap, because then you get
    00:17:58,709this problem, and you also can't push this effect very far,
    00:18:04,921because you will start to break the edges of your objects,
    00:18:07,801and it just won't work anymore.
    00:18:10,187There are some compositing tricks you can use
    00:18:13,226to manipulate your depth pass to help solve
    00:18:17,345some of those problems, but you'll never solve them all.
    00:18:20,014Really quickly, I want to show you guys
    00:18:21,873how I would do this in Nuke,
    00:18:24,643because it's a little different,
    00:18:25,690and the plugin that comes with Nuke is,
    00:18:29,334in my opinion, it's a lot easier to use than Frischluft,
    00:18:32,226and it's also more powerful.
    00:18:34,611It's got some more options.
    00:18:36,383It does a better job.
    00:18:37,372So, I just want to show you guys
    00:18:38,856just so you're aware of how this works
    00:18:40,840in other applications, and I'm gonna be doing
    00:18:43,262a lot a Nuke tutorials, because I think Nuke is amazing,
    00:18:46,318and if you guys are really interested in making
    00:18:50,101your renders and 3D scenes look really, really good,
    00:18:53,975Nuke is the best way to do that.
    00:18:56,494So, I want to bring in my renders,
    00:19:00,339and I'm not gonna go over exactly how I'm doing this
    00:19:04,046in Nuke, 'cause this is not really a Nuke tutorial.
    00:19:07,962So, this is my image, and in Nuke when you bring in
    00:19:13,816a multi-pass image that only has one channel,
    00:19:16,313it shows up in the red channel.
    00:19:18,283So, that's why it's red.
    00:19:19,351So, in Nuke, briefly, you have to,
    00:19:26,847you have to, it doesn't work the same way as After Effects.
    00:19:31,664I don't put an effect on this clip,
    00:19:35,871and then feed it this image.
    00:19:37,555Sometimes you do that, but a lot a times
    00:19:39,696what you actually have to do is first
    00:19:41,677combine these two images,
    00:19:43,406and so what you're doing is you're taking this image,
    00:19:47,816you're creating a new channel for it,
    00:19:53,208and then you're combining that channel with this channel,
    00:19:56,488and it may not make any sense what I'm telling you,
    00:19:58,426but the result of what I just did here
    00:20:01,643is I allowed Nuke to access both this image,
    00:20:06,558and this image here at the same time,
    00:20:10,149and so if I now look at this depth channel,
    00:20:13,531you can see that the depth channel is now set
    00:20:16,253to be this image.
    00:20:18,022That was just kind of a house keeping step
    00:20:20,021I had to do, and now I can use the ZD focus effect.
    00:20:25,066It's built into Nuke, and this is Nuke seven.
    00:20:27,626This is newest version.
    00:20:29,192This used to be called Z blur,
    00:20:31,413and it didn't have quite as many bells and whistles,
    00:20:33,597but it worked almost the same.
    00:20:35,280So now, I have my ZD focus.
    00:20:38,802Now you can see things are already out of focus,
    00:20:40,647and the quality of the blur is really good in Nuke.
    00:20:44,601It just seems to do a better job.
    00:20:47,574So now I need to change a couple things really quickly.
    00:20:53,018Right now the math for this effect
    00:20:55,817is set to far equals zero, and my other option,
    00:20:59,933I have a bunch of options, but another option
    00:21:01,868is far equals one.
    00:21:03,600My depth pass is set up where things that are
    00:21:06,677far away are white.
    00:21:08,652So, zero is black.
    00:21:10,598One is white.
    00:21:11,877So, I want far to equal white, which is one.
    00:21:14,547So, I'm gonna change that.
    00:21:16,483Alright, you can see that this effect,
    00:21:18,899it just like in Frischluft it has a focal point
    00:21:21,325that you can move around interactively,
    00:21:23,379and it will change what's in focus on your scene.
    00:21:28,401What's great about Nuke, and why I prefer doing
    00:21:32,753it this way is because you can also
    00:21:36,184very easily control exactly what's in focus,
    00:21:39,267and what isn't.
    00:21:40,583If I go to output, and I do focal plane setup, alright.
    00:21:45,193If I move this focal plane slider,
    00:21:47,699you can see I'm moving the exact point on my image
    00:21:50,906that will be in focus, the same as Frischluft,
    00:21:53,669but the other thing I can do is I can then
    00:21:56,793expand the depth of field so it could be
    00:22:00,694anywhere I want.
    00:22:02,004So, the green is telling me this is in focus.
    00:22:04,623The blue is telling me this is in front of my focus,
    00:22:07,830and the red is behind my focus,
    00:22:11,408and so whereas in Frischluft you had to
    00:22:14,365pick your focal point, and then pick your radius
    00:22:17,582of your effect, and that's all the control you have.
    00:22:21,256In Nuke, you can actually dial this in
    00:22:24,910exactly where you want it, and then tell it
    00:22:27,833how much blur to apply.
    00:22:29,890So, you get a lot more control.
    00:22:31,411It's easier to get the effect you're going for.
    00:22:34,056So, let's say we want to be focused right there
    00:22:36,778on this cube, alright, and I want the depth of field
    00:22:41,386to be pretty small.
    00:22:43,645So, even the back of the cube is starting
    00:22:45,623to go out of focus.
    00:22:47,348So now if we go back to result you'll see that now
    00:22:52,527we've got the same effect that we had in After Effects,
    00:22:57,373except now I can keep the exact same shallowness
    00:23:01,487of my depth of field, and I can just up the blur level
    00:23:04,616a little bit, and you know, this part of the image
    00:23:10,036to this part of the image is still in focus,
    00:23:12,546but the rest of it is more out of focus.
    00:23:15,179Now again, you're seeing the same problems we saw
    00:23:18,150in After Effects with this edge of the cube
    00:23:21,529should be blurred, and it's not.
    00:23:24,124So, we're still running into the same problems in Nuke
    00:23:28,328we ran into in After Effects.
    00:23:29,683If you use a depth pass, you are somewhat limited
    00:23:32,443to the result you can get, and there's some
    00:23:37,553compositing tricks to help with it, but in the end
    00:23:39,940you're not gonna get the best result this way.
    00:23:43,756So, now I'm gonna show you a different way to do it,
    00:23:48,648and I'm gonna talk a little bit about the pros and cons.
    00:23:51,862So, the pros of doing it the way I just showed you
    00:23:54,712with depth pass, the main reason is that
    00:23:57,514it's much, much faster.
    00:23:59,944When you render images in 3D, and you have your 3D app
    00:24:05,418calculate depth of field, it takes a lot longer,
    00:24:08,763and then just as important is that if you
    00:24:13,370put the depth of field on in compositing,
    00:24:15,803you can always change it.
    00:24:17,820If a client says that's, I don't like how blurry
    00:24:20,795things are getting.
    00:24:21,913Can we sharpen that?
    00:24:23,687Yes, really easily, and you don't have to go back
    00:24:25,872into Cinema and re-render things that
    00:24:28,154may take hours or days, or whatever.
    00:24:32,059So, it's much more controllable, and it's flexible,
    00:24:37,739but the quality of the result will
    00:24:40,593never be as good as just actually doing it in 3D.
    00:24:45,049So, the way I kinda look at it is
    00:24:48,531you have to know your client, and you have to
    00:24:51,670kind of understand what's important
    00:24:53,893on the project you're working on.
    00:24:55,846If your client is a photography nut,
    00:24:58,519and a techy guy, then you could safely assume
    00:25:04,782he is going to want to noodle around with your renders.
    00:25:07,829So, you probably want to use a depth pass
    00:25:11,897with this guy, because he's gonna say things
    00:25:17,212like that's too out of focus.
    00:25:19,520Let's increase the depth of field.
    00:25:23,929So, most clients are not like that,
    00:25:26,892and I've recently started doing
    00:25:30,669most of my depth of field using Cinema,
    00:25:35,243and actually doing it in 3D, because the result's
    00:25:37,916so much better that it just makes everything
    00:25:40,553look nice, and in the end that's the most important thing.
    00:25:43,883The client is gonna appreciate whatever you do,
    00:25:46,930as long as it looks nice, and they're not gonna care
    00:25:49,249how you did it.
    00:25:51,397So, you always have to balance speed versus quality,
    00:25:56,821and make your own decisions.
    00:25:59,052So, what I'm gonna do now is show you
    00:26:01,251how to actually get depth of field
    00:26:03,008out of Cinema, and this is something
    00:26:06,336that you couldn't do one release ago without plugins.
    00:26:13,207One of these days I'll get around to doing a V-Ray tutorial.
    00:26:15,931V-Ray lets you render true depth of field
    00:26:19,388and true motion blur, and the quality is unbelievable,
    00:26:22,555but it is a plugin, and you have to learn it,
    00:26:25,923and it works very differently than the normal Cinema stuff.
    00:26:29,261Fortunately, Cinema added the physical renderer in R13,
    00:26:35,192and it has the ability to create depth of field.
    00:26:39,847So, all you have to do is enable the physical renderer,
    00:26:43,146go to depth of field, make sure it's checked,
    00:26:45,694and then there's some quality settings that
    00:26:47,922we're gonna leave default for now.
    00:26:50,681I'm also going to erase my file names
    00:26:55,019in the save so that we can do previews.
    00:27:00,909Alright, so we also don't need this multi-pass anymore,
    00:27:05,630because we're not gonna render a depth pass.
    00:27:07,865We're actually just gonna render depth of field.
    00:27:10,121So, the way depth of field works with the physical renderer
    00:27:14,538is now the focus distance is actually really important.
    00:27:20,209So, what we're gonna do is set this focus distance
    00:27:24,237as precisely as we can to focus on this cube here,
    00:27:28,560and depending on where your camera is,
    00:27:32,395and where your objects are, it's kinda tough
    00:27:34,651to tell exactly where it needs to be focused.
    00:27:39,208I mean, is that in focus on this corner of the cube?
    00:27:42,703I can't really tell.
    00:27:44,302The camera's at an angle.
    00:27:46,353It's just impossible.
    00:27:47,379So, what I like to do is create a null,
    00:27:51,133and I'm gonna name this focus,
    00:27:53,439and then in the camera settings under object,
    00:27:56,612you can drag that null to the focus object,
    00:28:00,203and that camera's focus distance
    00:28:02,502will now automatically be set,
    00:28:04,723calculated from this null.
    00:28:07,350So now I can just put null right there,
    00:28:13,492and so now the camera is literally focused
    00:28:15,574right on that point, and I'm gonna actually,
    00:28:17,711I'm gonna push it in just a little bit.
    00:28:20,258Okay, and then in the physical settings,
    00:28:28,658you can change these and actually control the exposure,
    00:28:33,799and things like that.
    00:28:36,090One of the things that I love about
    00:28:37,477using the physical renderer is that I don't
    00:28:39,506have to worry about that stuff.
    00:28:40,757I can if I want to, but I don't want to.
    00:28:43,562All I want is to make my scene look nice,
    00:28:46,162and then add depth of field to it,
    00:28:48,464and really for depth of field,
    00:28:50,897if you're not dealing with exposure,
    00:28:52,921the only setting you need to worry about is the F stop.
    00:28:56,039Alright, and if I just hit render real quick,
    00:28:59,828let me do a test render here, you will see that now
    00:29:03,381we have this corner of this cube in focus.
    00:29:07,613Everything else is out of focus,
    00:29:08,892and it already looks better, because you don't get
    00:29:12,436any of the artifacts.
    00:29:14,705Now, you are seeing this grainy stuff.
    00:29:17,258That's just because the quality on the
    00:29:19,485physical renderer isn't set high.
    00:29:22,123It's set to low right now, and that's good
    00:29:24,643because when you're just setting up your scene,
    00:29:27,693you want quick renders.
    00:29:29,918Once you set that setting high enough,
    00:29:32,631it takes a long time, and the result looks great,
    00:29:35,845but this could easily, and this is very simple scene,
    00:29:39,304this could take a minute, two minutes per frame
    00:29:42,978more in full HD on my iMac.
    00:29:46,937So, you always kinda work low res like this,
    00:29:50,678and then when you're ready, you up the settings.
    00:29:53,756So, now the true test is if we move this focus null,
    00:29:57,091and let's say we want to focus on this pyramid
    00:30:00,049way in the back here.
    00:30:01,982So, that's this one, and we'll lower it.
    00:30:06,755Focus on that.
    00:30:08,320Alright, so now I'm gonna hit render again,
    00:30:10,920and you'll see that you're getting,
    00:30:13,684this cube is getting blurry along the edges,
    00:30:16,849but you can actually still see this bucky-ball through it.
    00:30:21,410You're not getting those weird artifacts
    00:30:23,474along edges where things intersect,
    00:30:25,209because you're actually calculating depth of field.
    00:30:27,997Now, let's see what happens if we really crank this up.
    00:30:30,506If we go into the camera, and change this F stop
    00:30:33,515to a lower F stop, say change it to four,
    00:30:39,359now you're getting even heavier depth of field,
    00:30:41,294but you can still see the object through it.
    00:30:44,752So, when you do things like rack focus,
    00:30:47,799or when you set up scenes like this,
    00:30:50,475the result that you get is so much better,
    00:30:53,556especially when you crank the quality settings up.
    00:30:56,962So, you do have to always be careful that
    00:31:00,676you're not doing something that's gonna take
    00:31:02,862six hours to render, and then you cross your fingers
    00:31:05,742and you hope your client likes it.
    00:31:07,259That's not really a great option, either,
    00:31:09,717and a great strategy, if you ever find yourself
    00:31:13,293in this situation, is render one frame,
    00:31:16,948and e-mail it to your client and say this is
    00:31:20,402what I'm thinking, and point out the depth of field.
    00:31:23,738I have a shallow depth of field on this shot.
    00:31:26,669It takes a long time to render, but I think
    00:31:28,524it looks beautiful.
    00:31:29,555Let me know what you think.
    00:31:30,624If you like it, this is what I'll go with,
    00:31:32,776and that's all you have to do,
    00:31:33,889and nine times out of 10 that client's gonna
    00:31:36,117appreciate the fact that you're asking them,
    00:31:38,541and they're gonna look at that, and they're gonna say
    00:31:40,568wow, that's really cool.
    00:31:41,742That looks great.
    00:31:43,585You know what?
    00:31:44,418Turn the blurriness down 10%,
    00:31:46,021and you'll say okay, and you'll render
    00:31:49,063a variation of it, and you'll send it to 'em,
    00:31:51,184and now they're happy, and now you can
    00:31:53,278have your beautiful depth of field,
    00:31:54,883and your client feels like they were serviced.
    00:31:56,976So, there you go.
    00:31:59,368That's a free client service tip for ya.
    00:32:02,700Anyway, so that's it.
    00:32:03,850That's how you do depth of field in Cinema.
    00:32:07,590I want to say, I'll say one other tip, too.
    00:32:10,200One of the most common ways that
    00:32:13,199you can get around the issue that
    00:32:15,878you would have here with a depth pass,
    00:32:20,285and this sucks to do, and I don't like to do it,
    00:32:21,982but what you can always do is turn this cube off,
    00:32:26,552render your scene, and then render this cube
    00:32:29,440all by itself, separately.
    00:32:32,069That way in After Effects or Nuke,
    00:32:34,212you could composite this cube back on top,
    00:32:37,341and blur it, but still have the information
    00:32:39,692about what's behind it so you can still
    00:32:41,965get a nice blur.
    00:32:44,371You know, I don't like doing that,
    00:32:45,320just because then you have two renders to deal with,
    00:32:50,226and manage, and if you change that shot,
    00:32:52,644or there's a last minute revision,
    00:32:54,404now you have to remember, and you have to track
    00:32:57,082that oh, I have to render this shot twice,
    00:32:59,521once with this cube off, and once only with this cube.
    00:33:02,562Then I have to composite them together.
    00:33:04,294So, it does work, but it's kind of a pain.
    00:33:07,522So, one of, you know, using depth pass,
    00:33:10,694or doing it this way, those are the most common ways
    00:33:12,792of doing depth of field.
    00:33:14,436I hope this was helpful.
    00:33:15,992Thank you guys for stopping by,
    00:33:17,527and I will see you next time.
    00:33:19,668Thanks for watching. (upbeat music)
    00:33:20,659I hope you learned a lot about what depth of field is
    00:33:22,517and how to use it effectively to take
    00:33:24,949your 3D scenes to the next level.
    00:33:26,877Thanks again, and I will see you next time.
    00:33:29,927(bottle rocket whirring)
    00:33:30,951(pen bouncing)
    00:33:31,941(upbeat music)
    00:33:36,843(birds chirping)