Tutorial - Fusion, Zdepth, EXR's, 3dsmax by David Mackenzie

10. Adjust the settings to get the desired effect

It is AMAZING how often people ask me about this. I wrote a tutorial way back in 2010 about how to use Z-Depth passes in Fusion. To this day it still gets a lot of traffic. However, that tutorial is somewhat out of date and seems to be causing more confusion than clarity. So here is an updated tutorial. If you are really unsure about Z-Depth passes I would recommend you go and read the old one here and then come back to this one as I am not going to explain the basic aspects in this tutorial. I will also explain how to use a Z-Depth pass that is stored in a EXR file which I did not do in the last tutorial. So here goes. First off make sure you render something to an EXR that will have the Z-Depth pass embedded in it. This is not difficult to do, I am max guy so below is a screenshot of the 3dsmax exr save dialog showing my setup. The main things to look out for here are the "Automatically Add/Remove Render Elements" checkbox and the G-Buffer channels at the bottom, both of which are outlined in green. If you have a render element that is creating Z-Depth pass then it will be automatically embedded. For instance if you are rendering with V-Ray and you have a "VRayZdepth" pass in the element list you probably do not need the G-Buffer Z-Depth channel. I as habit always save a few G-Buffer channels as a 'just in case'. Often I will get handed a file that has had Z-Depth element added to it but the ranges have not been correctly setup, in this case it can be handy to have G-Buffer passes.

3dsmax EXR Settings

Hopefully by this point you have a render to take into Fusion. So lets get to it, this is super simple.

  • Create a "Loader" (LD on the toolbar) and load up your render.
  • Go to "Tools" panel and click on the "Format" tab.
  • Expand the "Channels" flyout.
  • Go all the way down to "Z".
  • In the drop down list for "Z" select your Z-Depth pass. This will depend on what you have named your render element. In my case, I select "VRayZDepth.R" (In 99% of instances you can select either the red, green or blue (.r, .g, .b) as they will all be the same.
  • Now if you click in the viewer press "Z" on the keyboard you should be able to see your Z-Depth pass. If you screen is all white or it is hard to see hit the normalise button so you see it properly.
  • Now you can add either a Depth Blur or a Fog node. They will automatically see the Z-Depth information.
  • Adjust the settings on either your depth blur node or your fog node.
  • Done, easy.

That's it. If you are unclear of anything above you can follow that same procedure in the images below which might make it a bit clearer.

[gallery columns="4" link="file" ids="1090,1091,1092,1093,1094,1095,1096,1097,1098,1099"]

I hope that helps everyone. I might do a video if I get time, along with my workflow for using Frichluft Lenscare which is what I normally use to create any DOF effects. If you have any other questions leave a comment and I will try to get back to you.

7 Things to know in Fusion by David Mackenzie


Below is a short collection of a few features in Digital Fusion that I use on a daily basis. Often they are over looked or forgotten about. For those of you who are experienced fusion operators or compositors then you will most likely had have heard about and used these features many times before, those of you who are new to fusion you may not have yet come across these.

  • Proxy Proxy Proxy! As soon as you jump onto a project where the resolution is HD, 2k or above it can often be very beneficial to turn on the proxys as then can have a huge impact on the speed and responsiveness of Fusion (or any package for that matter). Its important to remember the while working with proxys enabled you can work faster there times when it can be detrimental to you work flow for instance I would not use proxys while doing roto or keying but most other exercises its a positive.
  • Channel Booleans. Similar to Shakes Re-Order node and Nukes Shuffle node, it has to be one the most frequently used nodes in my composites. Brush up on your math and master channel operations seasoned compositors use them in ways that most of us could only dream of.
  • Add Pipe (Alt-P). This simple feature lets you place blank node that is used for tiding up your composites, which is the most important thing you can do when working within a team. A well layed out and named composite is the ultimate mark of a professional. Say no to slap comps!
  • Double Edged Poly lines. This often over looked feature by artists new to compositing especially those coming from a 3d background . Double edged masks allow you to define the falloff on an edge in a mask by adding an additional edge to your shape. This is great when you are working on footage that has a lot of motion blur etc. Check the help file for more information.
  • Expressions. Perhaps the darkest of dark arts when it comes to compositing, for me getting to grips with the math behind compositing and learning how scripts and expressions interact with Fusion (or any other package) has been the single greatest thing that has unleashed me as artist. If you are technically inclined then I really encourage you to jump on the band wagon. The amount of macros that I have created that feature custom nodes taking advantage of expressions is huge and has aloud me to solve many production problems.
  • Macros. Macros as far as I am concerned is one the best way to speed up a post production work flow. If you are working in a team then macros provide you a way to standardise your workflows while speeding it up. Perhaps the most important things macros can achieve is that ensure consistency, this is very important on large projects and large teams.
  • Audio. This one is Fusion specific, often you need to load up some audio to time out a comp to especially if you are working on some motion graphics etc.  Now loading audio in Fusion while very simple is not obviously apparent (at least to me it was not). To save your self some hunting around if you do need to load some audio look no further than the Saver node and hit the audio tab. Remember that when you do load audio into Fusion be mindful that Fusion will load the entire audio file into ram.

Well I hope some of that helps you in your compositing. I would love to hear any tips and tricks that you use in compositing, 3d and animation.



Audi S5 Burnout by David Mackenzie


Audi S5 Burnout Image This a scene I put together a year or so ago to show case my new car rig. It is a very simple animation with only a few key frames used to generate the animation, everything else is handled by the rig. You can see the animation in the below. Keen observers will notice that the one of the front wheels does intersect the body work, this however was my fault for not setting the limits correctly.

I have also included a quick compositing brake down after the animation. I am happy to say that as soon as we get some time to prepare the rig for distribution we will make it available to everyone.



Hope you guys liked it.



Using Z-Depth Render passes in Fusion by David Mackenzie


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.

Z Depth pass and Base render
Base render on the left with its zdepth pass on the right Although the z-depth pass is very white is was saved in float as a EXR so there is plenty of range.

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".

Channel Booleans Setup

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!

Fusion Flow
Notice that teh z-depth loader is the top node that is being piped into the "FG" input of the channel booleans.

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.

Fusion Add Depth Blur Screen Capture
Fusion Add Depth Blur node

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.

Base render with depth blur and fox applied to it.

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!

Maxscript, speed up your workflow by David Mackenzie


Every day I get asked if a can whip up a script for this or a script that etc. More often than not I just walk over to the artist machine and do a very simple type in, maybe a few lines at most and that will solve their problem. Now not that I mind walking to someones desk to help them I thought I might take a second to discuss some ideas about manipulating large numbers of objects quickly, effectively and working on specific object types.  I really believe that scripting can empower artists, many artists shy away from scripting especially when there sitting next to a TD but a simple understanding of some simple scripting ideas can speed up an artists ability to work. I do not intend this to be a introduction to scripting. I just want to show you how you can manipulate objects quickly using simple loops, basic conditional statements and the max script listener.

For Loops

Loops are how we iterate over objects, numbers, arrays etc. I found the best explanation of it in the Maxscript help file, "The for loop iterates through a range of numbers, time values, or a sequenced collection of values, such as an array or object set."

In this example we will be iterating over materials, a specific type of material. There are a number of way one can accomplish this you could simple iterate through sceneMaterials and check to see if each material is the correct class that you want, this however would be slow and unnecessary. Instead we are going to use the getClassInstances function that will return an array of objects of a given type. For exmaple:

getClassInstances Sphere -- This would return an array of every instance of a sphere in the scene. getClassInstances VrayMtl -- This will return an array of every Vray Material in the scene.

It is very simple to use the array returned by getClassInstances() in a loop. for i in (getClassInstances VrayMtl) do(print i) --This will print every Vray Material in the scene

So now that we can iterate a given type of object or "class" we really want to be able to do something with them. An important concept to understand is that when we loop through the returned array each item in the array as we move through it is stored in the variable "i". Consider the following code:

for i in (getClassInstances Sphere) do(i.radius = 100)

That statement will set the radius of every sphere to equal 100. It does this by first collecting them using the getClassInstances() function and "moving" the variable "i" through the array where "i" is used to access the  radius property and set to 100. We could also do something a bit more interesting like set the radius of every sphere to be random. We will use the random function in this example to give us a random integer. for i in (getClassInstances Sphere) do(i.radius = (random 25 100)) Now each sphere will have a random radius between the 25 and 100.

Unless you really wanted to create Spheres with a random radius lets move on and learn how to do something useful.

The Maxscript Listener

Using the listener you are able to record your "actions" so to speak. This is a very easy way to query a property that you may wish to manipulate in a script. For example you might want to turn off trace reflections on all V-Ray Materials. To do this open the max script listener (Maxscript -> Maxscript Listener or hit F11). Once the listener is open go to the Macro Reorder menu and enable the macro recorder.

Open Maxscript Listener Screen Capture

Maxscript Listener Enabled Screen Shot

If you now go and open the Material editor select a V-Ray Material and Turn off Trace reflections. Imediately you should notice that Listener updating, in this example it should read something like:

meditMaterials[1].option_traceReflection = off

In the above piece of code where are interested in everything after the ".", meditMaterials provides access to the materials in the editor (another article for that).

Now using what we learnt in the section covering loops we can now go ahead an change every V-Ray material in the scene:for i in (getClassInstances VrayMtl) do(i.option_traceReflection = false)

How easy was that? As you can see simple type in expressions or loops can save you a great deal of time. Just to recap we very quickly went over using loops with the getClassInstances() function and using the listener to ascertain what property's we need to change. If you have any question then please just post in the comments I will do my get back to ASAP. Also remember the maxscript help file is your friend it is a fantastic help, if you are having trouble of some of the more basic concepts I suggest you start there.

I hope that shed some light on some very simple scripts that you might be able to use. If you have an idea for a tutorial use this form, I am more than happy to tackle any challenges you have in 3d or 2d.