Monday, February 8, 2010

Z Depth with Maya and Nuke

So large environments just don't look right without atmospheric depth, and z depth outputs are usually the easiest way to get such an effect. I figured I'd make the whole process easier by automating the creation of z depth shaders in a scene.

The shaders use samplerInfo nodes so they're compatible with pretty much any renderer in maya. The other advantage is that you get motion blur, depth of field, and the same antialiasing as the beauty passes rendered into the z output, so the results are very accurate. There are also a lot of nodes for tweaking falloff such as a remapValue and blendColors node, so you may want to look for them to get more precise control.

Anyhoo... with one button you'll be able to apply z depth shaders to all objects, while preserving displacement shaders as well as materials with transparency. Give it a try and let me know if it helps. I've also put together a 15 min tutorial on how to use it, as well as comping the outputs in nuke, so check it out!


  1. Very nice, Bo! Thanks (as always and yet again) for putting together a greatly helpful tool.


  2. This is probably a dumb question, but how do I download this script. It just keeps popping up in a new tab with all the words in the script itself.


  3. Hi Bo! I've been looking for a script like this for a long time.
    The mel script link seems to be dead though. Even tried getting it last month. Can you reupload it?


  4. Hey sujil, just updated the post, but also, you can find all the scripts at

  5. Shouldn't a zDepth pass be *aliased*? And shouldn't a zDepth pass be float, therefore eliminating the need to worry about visual shades of grey to set the range?

  6. I should say, this script looks awesome, but I'm just saying it might be solving a problem that shouldn't actually be there... ;)

  7. Hey geoff, totally agree, but this was more intended for color correcting, and aliased zDepth without motion blur didn't really work for that. It'd be good to have an option for either way though!

  8. This..... is pure awesomeness !

  9. Hey. I just found out this. It looks awesome. *Although I had a problem along the way.

    I can execute the script in maya2013 in a new scene but if I try to use "create z shaders" on the project that I am working it gives me the error "no object matches name:"

    what am I misssing?