This is question I get on a almost weekly basis, how can I use my Z-Depth pass in fusion. For those of us who have been compositing for some time it is a dead simple thing to do but for those of you who are learning to composite or even just new to Fusion or other node based tools you might find this useful. First off if you are rendering OpenEXR files then chances are your Z-Depth pass will already be in the file which means all you need to do is add a depth blur node to your flow (see below), you can test to see if the Z-Depth pass is already present by clicking in the viewer and hitting "Z" on the keyboard. If you are rendering it as separate file or as a render element then I will show you how to incorporate the channel into your flow below.
Z-Depth Pass A couple quick notes about z-depth passes. First off I want to take a moment to mention that you really should be saving your z-depth passes at a minimum of 16bits per channel the higher the better. Secondly make sure the you have enough range in your z-depth pass, you will want to make sure the all of or most of your scene is visible in the channel. Sticking to those two point you will ensure you have a good amount of "play" in your pass for when it comes time to picking the start and end points of fog etc.
The Fusion Comp The fusion comp is very simple. The process I use is the most basic it involves loading your beauty pass then adding a "Channel Booleans" to the flow (make sure the beauty pass is connected to the BG input). Now load your z-depth pass and pipe it into the FG input of the channel booleans. Select the channel booleans and set the "Red", "Green", "Blue" and "Alpha" channel to "Do Nothing". Now hit the "Aux Channels" tab, click the "Enable Extra Channels" radio button. Once the Auxillary channels are enabled select the z channel and set it to "Luminance FG".
That process basically copy's the z-depth pass to the z-channel of your flow which will carried all the way down your comp from this point on. This means that at any point in your comp you can access that Z-Depth information. A couple quick points you can view the Z-Depth channel by clicking in the viewer and hitting "Z" (You can push "C" to get back to colour) if you see a red "X" in the viewer then something has gone wrong as the view is unable to display a Z channel. If you see black you might want to try hitting the "Normalize Luminance" button which is the right most button at the bottom of the viewer, this will normalise the data so it can be viewed generally speaking you will only need to do this if your Z-Depth pass is in floating point, remember to turn it off otherwise your results will vary frame to frame. If you ever leave it on and do a couple hours worth of colour correcting only to realise your output is still being normalised, I guarantee you will only do it once!
To quickly recap, we have copied our Z-Depth pass into the Z Channel of comp so that it can now be accessed. Lets move on and do something useful with it!
Depth Blur There are many nodes inside of fusion that can take advantage of the z-channel. Nine times out of ten everyone wants to use there Z-Depth pass to create a DOF (Depth of Field) effect in post, so thats what we will concentrate on.
Luckily in Fusion this is very easy to do the Depth Blur node is very quick and easy to use and although it does not generate the very best effect allot of the time in can be used to enhance a scene, in any case it is one the building blocks to generate a really nice effect (That might be the focus of another tutorial?).
So lets go ahead and add a Depth Blur node by right clicking in the node view and selecting Add Tool -> Deep Pixel -> Depth Blur.
You can now use the "Pick" focus point tool to set the focus area, you can also use the slider to for finner control. Most of the controls are pretty straight forward the best way to get your had around them is play with them and check out the results. You can see the results of an example I prepared earlier below. Also try experimenting with the Fog node.
If you have any ideas for other 3d or 2d tutorials please let me know here. I hope that helps you out next time you are having trouble with Z-Depth Passes. If you do run into any trouble then post a comment! Happy Compositing!