Shader Family: Surface Material
When doing rendering that requires no form of post production, transparency requires no special consideration: you simply add a transparency shader of some sort, and mental ray will render it correctly.
However, as soon as you begin performing post production work on the image, and rendering to multiple framebuffers, even if using mental ray's built-in depth and motion vectors framebuffers, special thought must be put into how transparency will be handled.
In general, mental ray collects its framebuffer data from the eye ray: the ray shot by the camera that hits the first object. Therefore, the z-depth, motion vector, etc. will come from this first object.
So what happens if the first object hit is completely transparent? Or maybe it is transparent in parts, such as an image of a tree mapped to a flat plane and cut out with an opacity mask, standing in front of a house? (Using flat images to represent complex objects is known as putting things on "cards", hence the name of the shader.)
When using other transparency related shaders it is most likely that even though a tree is quite correctly visible in the final rendering and you can see the house between the branches, the z-depth (and other framebuffers) will most likely contain the depth of the flat plane. For most post processing work, this is undesirable.
To solve this problem the mental ray API contains a function called mi_trace_continue which continues a ray as if the intersection with the first object hit never happened. The Card/Opacity (mip_card_opacity) shader uses this function internally, and switches between "standard" transparency and using mi_trace_continue to create a transparent object at a given threshold.
The shader's input parameter port is the color of the object.
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License