Limiting light to certain objects in Cycles

In the old BI renderer you could specify that certain lights should only shine on certain objects. I’m wondering the best way to achieve the same effect in Cycles.

First, since Cycles is a GI renderer there is an extra complication, because light can bounce off an object I DO want illuminated and then hit an object I DON’T want illuminated.

But ignoring that for the moment, what is the best way to achieve a similar result. It would be nice if the Light Path node could supply the ID or name or Attributes of the originating light source. Attributes would be the most flexible. Then you could attach attributes to a light and test against them in material nodes through the light path.

You may find the following article useful:

Interesting. It looks like the only available method is to separate objects onto different layers. That can work in a pinch, but isn’t that great overall.

The more I think about it, the more I think it would be a good idea to add a Light Path input that provides access to Attributes of the light that initially generated the ray being evaluated. I’d like to make this an official proposal and gather feedback.

Examples of usage might be: creating a light with an Attribute named “Black Light” with a value of 0.8. I can then make a material that queries the “Black Light” Attribute of the light source and do some multiplication piped to a purple color ramp followed by an emissive shader.

Or I might create a light with a very low intensity that I don’t want to shine on the whole set, just an important prop. I could add an Attribute called “Hero Light” and add that value to the incoming light intensity.

Conversely, I could make all my other materials ignore the “Hero Light” and then allow the hero prop material to behave as normal.