Nuke | Tips And Tricks: Depth Of Field

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
one advantage of using the powerful pausing program like nuke is the ability to create effects you might normally create in a 3d program like Maya for example you might normally render motion blur or depth of field but you can apply those in Nuuk instead and save a lot of time in some cases for example we'll use this render creo Maya to apply and artificial it up to field and even a rack focus let's take a look at that this is just an opening X our sequence and the sky is black because it's just empty space back there in Maya to add sky inside nuke I simply merged the image sequence with a constant which has a solid color now this footage does include a depth channel which we can use in combination with a C to focus node to create the depth of field I know there is a depth channel there by looking at the green - on the bottom right of the node initially you can't see that that's the channel inside the viewer normally when you run your mouse over the viewer you'll see the red green and blue values and the Alpha values those are read out right here but there's no Z normally if you press the a key inside your viewer you'll see the Alpha Channel there's the Alpha however if you change the second menu here from RGB alpha to another channel like the Z Channel you can see it right there in the viewer this case is Z depth channel is called cam Z depth render camera Z the important part is a dot Z I know that's the depth there is now the Z Channel assuming that I've switched a second menu and also I'm on the a on the third menu which is controlled by the a hotkey I run my mouse over it now the part is firmly alpha right here the whites readout will tell me the values of my Z Channel now this could vary based on what renderer you used to render out the depth channel but in my case the parts of the model that are close to the camera have values in Z that range from say 2 to 3 parts are a medium distance or around 16 and parts are further away at values of around 24 now in this case the empty space has a value of 0 even though there's quite a range in values there most of it just looks white and that's because nuke supports super white values in other words the values can go above the standard 0 to 1 but the values are there and we can use them with the Z to focus node there aren't issues with interpreting the Z values correctly with this footage it's going to be a problem to have a 0 Z value wherever there's empty space for us values that are smaller should be closer to the camera that's okay we can doctor the Z channel to get us the results we want one way to do that is to apply a shuffle and emerge the results with another constant let's give it a try with no node selected I'll right mouse button click and choose channel shuffle I'm going to hook that up to the read one node let's take a look at the shuffle parameters by the fault the rgba of input 1 is being exported as our DBA however I can change that first menu down to that depth channel and you'll see it says Z that will send the Z values out through the red green blue and alpha channels that'll make it easier to combine the Z with some other input in fact the next thing I'll do is create a merge node so right mouse button click with nothing selected and choose merge merge you can also press the M hotkey I'll just attach the a input to the shuffle I'll create a constant next in this case and go to the image constant node this will create a solid color then I'll attach the B pipe or the merge to the constant now the constant can create solid color however you can also use it to simply hold a very specific value now going back to our original render remember that the empty area has a 0 Z depth value what be great is to have that area have a even higher value so it's even further back in terms of the Z Channel so if the distant wall is around 24 let's make that really far this an empty space have a value of 30 for Z so I can go to the constant 2 node and open up the parameters and then instead of picking a color through the color wheel or the eyedropper I can go to the forward button and enter specific values into red green and blue this case will enter 30 so 30 30 30 let's take a look at the merge results from merge two and here because we've shuffled this into the RGB I need to make sure to go back to that view I'm going to press the a key again I can see that the RGB runs from around 2 or 3 in the foreground area to around 16 in the middle ground where the house was 230 in what was empty before now let's combine that with our original image sequence so we can make it out of focus so it's a great place for a shuffle copy so right mouse button click channel shuffle copy I'm going to connect the 1 pipe into the first merge with the original image sequence and the two pipe into our doctor to Z information and then I'll grab the viewer and reconnect that at the bottom there let's look at the shuffle copy and want the 1 input which is our original image sequence to provide the red green blue and alpha so make sure those are all checked in a diagonal fashion so I'm going to set the second menu at the bottom right to other layers depth that's the Z standard z channel for nuke if I shall see when I switch it it'll say Z right here is an output channel I simply need one of the channels coming in from input 2 and red is fine actually red green and blue are identical so I can simply just use red now we can grab a focus node and actually create the out of focus it's a right mouse button click this is under filter Z to focus it's similar to a blur but it requires Z Channel I'll connect the input pipe to the shuffle copy node and then plug the viewer into it now it's going to work right away but there are some things you need to adjust make sure that the blurriness is appropriate the first thing to check is to make sure the depth channel menu is set to the correct incoming Z channel in this case we are actually using deff Z so that's perfect X scene to check isn't math again every renderer may output a slightly different style zyy information therefore there are a number of different presets that apply different mathematics to interpret the Z values differently in this situation though we can just change this menu to depths we altered the depth information to the shuffle node the merge node and the second constant well we know what the values are so we can use them as is to represent distance from camera now in terms of what's in focus what's out of focus and the grreat blurriness or some other parameters you can set for example a focus plane is the distance from camera that is in focus so for example if I set this to a low value like 2 and give it a moment to render then the part that's mostly in focus is going to have a low Z value which in our case is this foreground wall I said to a higher number like 24 the area in focus is the part that carries values of 24 so you can pick where that point of focus is can also control the amount of blurriness on the part that's out of focus can do that by adjusting the size the size is the filter that's applied to average the image and create the fuzziness so a higher number here creates more fuzziness on the part that's out of focus the lower the value the less fuzziness the maximum is related to that the maximum is the maximum size of the filter that's used for the part that is the most out of focus the part that's the furthest away from the focal plane so you can see that when I raise size and especially raised the maximum that the foreground has become much bluer another way to fine-tune the result is to adjust the depth of field parameter if the field controls the size of the area that's in focus so a larger number here will give you a wider or a longer focus range from the camera so if I raise it to a very high number more and more things are in focus a lower number like zero means that the area of focus is very narrow I'm going to try a slightly larger number point five now what's fun here is you can actually animate this to create a back focus for example let's say that I want the foreground to be in focus on the early frame so I'll go to frame 10 kin-kee the focus playing parameter changing let's say it's frame 10 I want to make the focal plane say 2.2 which is a foreground and key that by right mouse button clicking over the animation menu button and choosing set key then go to a later frame say 38 and shift that focus plane to a number that's further away so let's say 18 which is a value at the far wall of the building as soon as I had our new number I get a new key frame so here is frame 38 where the building isn't focused the foregrounds out of focus on frame 10 we have the opposite and since is animated this will shift over time even though the viewer is going to take a few seconds to render each frame because of the heavy blur it can still be more efficient than having to render out the depth of field through the 3d program in fact I'm going to jump ahead and show you a results rendered out through a writes node so you can see the final result of the rack focus all right so I've written out this particular network through right node as image sequence and I've opened it back up with an external viewer let's play it back so we can see the rack focus so you can see it starts from the foreground and racks the background in other words foreground starts in focus and that focus shifts to the background so here we've used a depth channel which is commonly supported by 3d programs in combination with a cue constant nodes a couple of merged nodes and a shuffle and a shell for copy along with the CD focus node to create a depth of field effect as part of the composite
Info
Channel: Foundry
Views: 46,406
Rating: undefined out of 5
Keywords:
Id: xJJTk0TIQ2o
Channel Id: undefined
Length: 10min 47sec (647 seconds)
Published: Tue Feb 06 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.