This shader makes it possible to evaluate different shader trees per ray. This decreases the shading complexity of a scene and thus the render times, and increases artistic control. It can be used to remove unnecessary secondary rays (specular/sss), make speculars even more glossy in specular rays, control the color of opacity in shadow rays to fake light scattering through tissue or add a second specular lobe in-camera rays only.
For an example of how the Rayswitch node can be helpful, see the reducing noise topic in the Image Based Lighting section (although note that the precise method described there would not be necessary if you use the Skydome light instead of the Sky shader).
There is also the Ray Switch RGBA shader for adjusting colors instead of shaders.
Plug the output of the shader you wish to use when calculating camera rays here.
Red Standard Surface shader connected to 'Camera' attribute of ray_switch_shader
The shader evaluation that happens for transparent shadows on objects. A use for this parameter could be to connect a ray_switch shader to the opacity parameter of a standard_surface shader. That way you can get a shadow that's different than the actual transparency of the object. For example, to reduce the amount of shadow cast by the object, or to use a different cutout opacity pattern.
Body object's standard_surface shader has red transmission_color (opaque is disabled)
Remember that the 'Opaque' attribute must also be disabled for the mesh when using opacity or transparency.
Plug the output of the shader you wish to use when calculating diffuse reflection rays here.
Red emissive shader connected to Diffuse Reflection attribute of ray_switch_shader
Plug the output of the shader you wish to use when calculating diffuse_transmission rays here.
Red emissive shader connected to diffuse_transmission attribute of ray_switch_shader
Plug the output of the shader you wish to use when calculating glossy rays here.
Red standard_surface shader connected to ray_switch_shader specular_reflection attribute
Plug the output of the shader you wish to use when calculating specular_transmission rays here.
Red standard_surface shader assigned to specular_transmission attribute of ray_switch_shader.
Plug the output of the shader you wish to use when calculating volume rays here.
Example use of Ray Switch shader. Scene file here.
Pepe model by Daniel M. Lara (Pepeland)