Controlling shader visibility with Cycles Light Path Node

Blender 2.79

The Cycles ‘Input > Light Path’ node is useful for creating shaders with a selective optical participation.
A simple example of that would be a bright light material that is ‘seen’ by the camera and through reflection / refraction but isn’t actually lighting the scene.

Basic Ray Visibility can be set at the object level via the object’s Cycles setting:


But when we need to set per shader, and more specific Ray Visibility, we can set it up using a ‘Light Path’ node within the cycles shader:


The ”Is ________ Ray” outputs will give a 0 / 1 value indicating if the sampled ray is of a certain type,
The Ray Length output will give a float value representing the ray’s real world length,
And the ‘_______ Depth’ outputs  will give an integer representing the number of light bounces that were computed until the sampled ray.

In this simple example we see how to use the Light path node to create a light shader that only affects reflections / refraction but not producing any diffuse light.

A Mix Shader is used to mix between a Transparent Shader and an Emission Shader.

The ‘Converter > Math’ ‘Maximum’ node is used as a logical ‘OR’ operator to produce a value of 1 for the mix factor if the ray type is either a Camera Ray or a Glossy Ray or a Singular Ray, and cause the Emission shader to be active.
For other ray types the mix value will be 0 and the Transparent shader will be active.

Basic Emission Shader:

Restricted Emission Shader:

* At the time of writing this post the ‘Is Diffuse Ray’ output of the ‘Light Path’ node didn’t produce expected results so I couldn’t create a light material that creates diffuse lighting but doesn’t  appear in reflections and refractions.


From the Cycles documentation:

Ray types can be divided into four categories:

  • Camera: the ray comes straight from the camera.
  • Reflection: the ray is generated by a reflection off a surface.
  • Transmission: the ray is generated by a transmission through a surface.
  • Shadow: the ray is used for (transparent) shadows.

Reflection and transmission rays can further have these properties:

  • Diffuse: the ray is generated by a diffuse reflection or transmission (translucency).
  • Glossy: the ray is generated by a glossy specular reflection or transmission.
  • Singular: the ray is generated by a perfectly sharp reflection or transmission.

One thought on “Controlling shader visibility with Cycles Light Path Node

Leave a Reply