Wednesday 25th Apr 2007

Zdepth example

This is a Maxscript for creating a pseudo Zdepth pass. I don’t generally use embedded zdepths in RLA or RPF frames as they can be very slow. Many jobs at Nexus make use of images on planes so swapping materials by hand isn’t an option. Check out Jim Lefevre’s Ambipur project for a great example.

This script allows you to keep all those masks and alpha channels but still render out a quick zdepth pass for compositing. It can also be quickly modified to make mattes and custom passes

To install the script download the zipped file and copy the UI and Script folders into your 3D Studio max application folder. Next time you restart Max you should find a new catagory in your Customise UI menu called BCtools, you’ll be able to assign the ZdepthSwapper to a menu or hotkey from here.

To use the script first save your scene (undo probably won’t work) as Filename_zdepth_pass or whatever, select the objects in the scene and run the script. You should find all your materials altered, go into any material and find the ‘zdepth_map’ map. From here you can change the near and far settings as you wish as they’re all connected and instanced. I usually just measure my scene to find these values.

As we’re Brazil users at Nexus it’s geared towards the standard Max and Brazil shaders (apart from Brazil basic and chrome) but you could easily convert it for other types.

Click to download the script installer.

I’ve been messing about writing Maxscripts for a year or so. None of them especially clever or well written but I thought this one might be of use to others.