How to create z-depth with transparency (opacity) in Vray?

Have you ever tried to render a Z-Depth pass in 3DS Max for a scene with a glass object like car windows and the refraction of the translucent material did not show? There is a way to fix this, and here is how.

Note: Changing the Affect Channels to All Channels will affect all of your different render passes which means Render Elements such as Colour Pass, Reflection Pass, and Ambient Occlusion Pass will be incorrent and they will lose information where the alpha is now inserted.

EXR file output will not work with this method. EXR files are convinient and ideal for multiple pass renders where you do not have any transparent materials, however, if you need to show transparency in your Z-Depth pass and you only want to render out once, then you will need to render out in something like PNG, Targa or Tiff. In this example, I will be exporting in PNG.

So here are the steps…

  1. In the material you wish to appear full/semi transparent for Z-Depth render pass, go to Refraction, and for Affect channels select Color+Alpha. The idea is to create an alpha pass just for the transparent material you want to display in Z-Depth.

    2

Note: If you already have an Alpha Pass, I suggest using an alternative element to save your current Alpha elements. A good one to use would be MultiMatteElementMultiMatteElement is much better than MatteID and MaterialID is because MultiMatteElement has antialiasing and the others, do not. Antialiasing will give you a more precise image to your renders. You will also be able to have multiple MultiMatteElementelements in a single render. Look at 6. to find out how to use the MultiMatteElement pass in After Effects.

3

  1. Save your render elements as Save seperate render channels and make sure you tick Save RGB and Save Alpha. In your Setup for a PNG Save, make sure you choose the RGB 48bit for post production optimization and DO NOT tick Alpha Channel or Interlaced.

4

5

  1. Render

  2. Import your renders as sequences for each Element into your chosen compsiting software ie After Effects.

  3. Precomp the Alpha and Z-Depth layers and in this comp, have the Alpha multiplied over the z-Depth. And Voila! Now you will have a Z-Depth pass showing the same refraction value as in 3DS Max.

6

  1. To use MultiMatteElement in After Effects, just apply a “set channels” effect to your multimatte and set its alpha channel to be the (red, green or blue). Add an Adjustment Layer and set it to use the multimatte as a track matte or an alternative workflow (that can look cleaner in your comp) is to use the “set matte” effect on the multimatte which will allow you to put your multimatte at the bottom of your comp, out of the way instead of above it like a trackmatte…