mip_rayswitch_environment

 
 
 

Category: mental ray > Texture

Shader Family: Environment

Output: Color

A classic issue you may run into with mental ray is that there is only a single concept for "the environment", whereas often, for practical reasons, you will want to separate the concept of a background from that of an environment.

The mip_rayswitch_environment shader accomplishes exactly that: it returns background for any eye ray, transparency ray (that is a child of an eye ray), or any refracted ray that travels in the same direction as the transparency ray (rays that were refracted by an IOR of 1.0 and are a direct child of an eye ray).

   

For any other type of rays (reflection, refraction, final gathering, etc.) the shader returns the environment color.

   

This shader is intended to be used as an Environment input, but it will function anywhere in a render tree as a ray switching node, in cases where you need to distinguish between "primary" and "secondary" rays. For example, this is the ideal shader to switch between primary and secondary rays when using the mip_matteshadow shader.