Example - Ray Type Switch

Last modified: 10 March 2025

The Ray Type Switch node allows you to surface items differently depending on how they are seen by the renderer. Here is a very simple example to show it in action.

Example-RayTypeSwitch_01.png

We have a red cube, a reflective cube and a glass sphere. You can just see the red cube in the refraction on the sphere (and if you're really sharp-eyed, a reflection of the sphere in the reflective cube).

We'll now adjust the surfacing for the red cube:

Example-RayTypeSwitch_02.png

To start with we just hooked a Ray Type Switch node between the Standard material and the destination Surface node. We used the Distance Input, which returns the "standard" rendered output.

On the Input node we hooked Ray Type to the appropriate input on Ray Type:

Example-RayTypeSwitch_03.png

For this example we are merely going to duplicate the red cube's standard node, but change its color to show the effect clearly. The copy named Reflection is green, that named Refraction is purple. Hooking them to the appropriate inputs on the Ray Switch node doesn't seem to have an obvious effect:

Example-RayTypeSwitch_04.png
Example-RayTypeSwitch_05.png

If we move the red cube between the two other objects, things become clearer:

Example-RayTypeSwitch_06.png