From the course: Nuke New Features Consolidated
ZDefocus: Setting the depth of field - Nuke Tutorial
From the course: Nuke New Features Consolidated
ZDefocus: Setting the depth of field
- [Instructor] ZDefocus is a major upgrade to the old ZBlur node and includes GPU acceleration as well as an improved algorithm, plus, several new features. Considerable effort has been put into improving its handling of edges and occluded areas compared to the old ZBlur node. While the ZDefocus node is GPU-accelerated, for the GPU processing to work, it requires certain NVIDIA GPUs And CUDA drivers. We'll start off by looking at the ZDefocus on a CG item. If you'd like to play along, you can get for the tutorials asset, the Z Fight.exr and the Z Fight BG.dpx. Now, this Z Fighter EXR file has it's own depth channel built in. By the way, critical point. The depth channel must not be anti-aliased. If it's anti-aliased, it'll introduce edge artifacts. So make sure your depth channels are not anti-aliased. If you're depth channel is anti-aliased, then you can unpremultiply it with the alpha channel to back out the anti-aliasing. - Okay, back to RGBA. I want to comp this over the background, so we'll select the Read node. Type M, get a Merge node, hook that up to the background and we have a lovely composite. Push in a little bit, take a look at the action. Now, in this merge node, I want to retain my depth layer which was cut off by the Merge node. So I'm going to tell it to also merge depth. So now, the depth channel comes out the output of the Merge node. Alright, put that back to RGBA. Okay, let's add our Zdefocus node. We'll select the Read node and come to the Filter tool tab. Click on that, go all the way to the bottom to get the ZDefocus node. And we'll dress this up to make it look pretty. Okay, let's push in and see what we've got. Well, this is not very nice. So our first step is we're going to pick out the focal point and put it where we want it to be focused on, which I'll put it right here. Ah, much better. The first thing you want to do is make sure that your depth channel is set correctly. If it's not in the Depth Z in your data stream, then use the browser to go get it. So wherever I place this focal point, that's going to be the part of the picture that's in focus. You can move it there, or you can dial it over here. Or you can even attach it to trackers. So you could do a Follow Focus if you wanted. Depth of field, of course, defines how deep is going to be in perfect focus and then out of focus on either side of that. We'll come back to that in a minute. Size, of course, is the amount of defocus. So let me push in here. I'll cut the size down. It gets sharper. I'll jump the size up. And, of course, I get a lot more defocusing. So the Maximum slider sets and upper limit for the deblur size. No matter how big the size value, the blur itself will get no larger than the maximum setting. Put that back to default. Now, let's take a look at this Math thing. This Math popup selects the rule for interpreting your depth map. By default, the Math property is set to Far=0, which is the behavior of Nuke and RenderMan. But other apps have different rules for their depth channel so you'll have to choose the right one here. You can look those up in the user guide. Now, let's take a closer look at the output options. Result, of course, is the defocused image. But we can also choose the Focal Plane setup. Now, this is a diagnostic view. This divides the picture into three colored zones. Red is in front of the depth of field. Blue is behind it. And green is the depth of field. Our depth of field was set at zero, so let's tap that up to 0.1. There we go. So the green part will always be in focus, and the red part will get progressively more our of focus towards the camera, and the blue more out of focus away from camera. As we move the focal point around we, of course, can change where that green zone lands. Put it back to here. And, if we increase the depth of field value, then the depth of field gets larger or smaller. So we can adjust that. And this setup allows you to actually see where it's happening. If you wish, you can also actually dial in the focus plane location right here. But, normally, you'll use the focus point, because what it does is it just samples the depth channel wherever you drop it off. It fills it in for you. Another output you might find helpful is the Layer setup. The way the ZDefocus node works is it actually sorts the image into layers in Z. You can actually see those layers here. This allows you to adjust the layer rule. By default, the automatic layer spacing is selected and the ZDefocus node has actually sorted it into what it thinks are the best number of layers. However, you can turn that off and set it yourself here. If I set to five layers, you can see I only have five layers in front of the camera. So I can tap that up to increase the number of layers. The more you increase the layers, the better the quality of the render, but the longer the rendering time. The Layer Curve control allow you to control the distribution of the layers. If you move this down, it stretched them from the focal point and moves them away further away from the camera. If you go in the other direction, it squeezing them. What this does, it gives you higher-quality renders as you get closer to the focal point. And we'll turn our automatic layering back on. Once you have the defocus parameters set, the next step is to dial in the appearance of the defocused parts of the picture. We'll look at that next.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
ZDefocus: Setting the depth of field5m 27s
-
(Locked)
ZDefocus: Adding a bokeh6m 1s
-
(Locked)
ZDefocus: Changing the bokeh appearance2m 54s
-
(Locked)
ZDefocus: Adding filter inputs3m 45s
-
(Locked)
SplineWarp: Drawing and connecting splines6m 56s
-
(Locked)
SplineWarp: Creating a warp4m 23s
-
(Locked)
SplineWarp: Setting boundary splines3m 37s
-
(Locked)
SplineWarp: Creating a morph8m 3s
-
(Locked)
SplineWarp: Refining the morph animation4m 59s
-
(Locked)
Deep compositing: Introduction to deep compositing5m 51s
-
(Locked)
Deep compositing: Editing deep images6m 57s
-
(Locked)
Deep compositing: Deep compositing nodes7m 38s
-
(Locked)
How to generate motion vectors2m 26s
-
(Locked)
Editing clips together with the TimeClip node5m 25s
-
(Locked)
Alembic geometry: Importing Alembic geometry6m 1s
-
(Locked)
Alembic geometry: Selecting geometry with the Scenegraph4m 46s
-
(Locked)
Alembic geometry: Exporting Alembic geometry4m 17s
-
(Locked)
PointCloudGenerator: Creating dense point clouds4m 36s
-
(Locked)
PointCloudGenerator: Setting keyframes4m 50s
-
(Locked)
PointCloudGenerator: Post-filtering and grouping6m 34s
-
(Locked)
DepthGenerator: Creating depth passes4m 39s
-
(Locked)
DepthGenerator: Refining the depth data3m 52s
-
(Locked)
DepthToPoints: Creating a point cloud from a depth channel6m 15s
-
(Locked)
DepthToPosition: Creating a position pass from a depth channel5m 30s
-
(Locked)
Converting a point in screen space to a 3D point3m 15s
-
(Locked)
Displacement node: Basic workflow3m 28s
-
(Locked)
Displacement node: Adjusting tessellation5m 25s
-
(Locked)
Shifting the timing of an entire node tree2m 3s
-
(Locked)
Shadow casting: Basic setup5m 7s
-
(Locked)
Shadow casting: Semitransparent shadows2m 54s
-
(Locked)
Relighting a CGI render with the normal pass5m 18s
-
-
-
-