Mesh lights on different renderlayers, how to setup?


I want to render some various indoor light groups separately and composite later. Bulbs are emissive meshes when on and diffuse/glossy when off. Currently I have:
Scene objects, incl bulbless lamps at layer 1.
Emissive bulbs on layer 2 (for when room lights are turned on).
Glossy/Diffuse bulbs on layer 3 (for when room lights are turned off).
Window area lights on layer 4. Also combined with environment.

At render layers I can then render:
Layer 1+2 for indoor lighting.
Layer 1+3+4 for light coming in.
Then add the two together in post for improved noise control.

I feel like I should be able to handle this completely different and much more efficient. I’ve been looking at some drivers tutorials, but I don’t get the feeling that what I want can be achieved that way. Is it possible to have material update (mix shader selecting between emissive and diffuse/glossy) change automatically based on renderpass/renderlayer? Manual update is not practical since I’d want to leave the rendering overnight and have both renderlayers ready for compositing the next day.

You could clone the lamps to different layers and add different materials to these clones. Set material link to Object instead of Data in Material settings to attach material to object instance, not mesh which is shared. Then you have the same light bulbs on different render layers, but on one they burn, on other, they are off.

It is not possible to query the render layer that is currently being rendered in shader.

Okay, I will try that out, thanks.