> [!abstract] Summary
> The **Ray Switch** shader routes different shaders to different ray types, letting you use a cheap shader for indirect/shadow rays and a detailed one for camera rays only. This can cut render times roughly in half on complex materials with no visible quality loss.
---
# Ray Switch
The Ray Switch node intercepts rays by type and routes them to different shader inputs. The key insight is that the majority of ray evaluations in a scene are **not camera rays** — most are diffuse indirect, specular indirect, and shadow rays that contribute to GI bounces and occlusion. These don't need full shader complexity to look correct.
## Inputs
| Input | Ray Types Affected |
| ----- | ------------------ |
| **Camera** | Rays directly from the camera — what you actually see |
| **Shadow** | Shadow rays from lights |
| **Diffuse Reflection** | Diffuse indirect bounces (GI) |
| **Specular Reflection** | Specular indirect rays (reflections of reflections) |
| **Volume** | Volume scattering rays |
## Typical Setup
```
[Full Complex Shader] ──→ Camera
[Simple Flat Shader] ──→ Diffuse / Specular / Shadow
↓
[Ray Switch] ──→ Material output
```
> [!tip] The simplest strategy is to plug a plain **aiFlat** or basic **aiLambert** into the shadow/diffuse/specular inputs, and reserve your full shader network for the Camera input only.
## Use Cases
- **Complex hero materials with many texture lookups** — avoids evaluating all textures on every indirect bounce
- **Hair and fur** — indirect hair shading is expensive; a simplified shader on non-camera rays cuts cost significantly
- **Layered or procedural shaders** — any material with heavy node graphs benefits from this approach
> [!warning] Avoid this technique on objects whose reflections appear prominently in other reflective surfaces — the simplified indirect shader will be visible in those reflections. Use it for background props, complex hero materials in heavy scenes, or anything where indirect contribution doesn't need to be exact.