I want to drive a property in a Cycles material based on the current Render Layer or Scene being rendered. Is there any such property? If not, is this something that could be made as an addon, or is there some technical limitation that prevents it?
You can use Animation Nodes addon to control both:
Basic setup for driving by active render layer:
- Scene Input node: Used for reading scene data. (Note: this node can only be found by searching via Ctrl + A. And, considering the huge amount of all kinds of nodes in AN, as a beginner, you may want to create the following nodes by searching as well.)
- Expression node: This is a very powerful node, which can do a lot of things. In this case, it is used for reading the name of the active render layer from data path.
- Compare node: It outputs the comparison result between A and B. In this case it means: if A is equal to B, or more specific: if the active render layer name is RenderLayer.2, then it outputs True, a boolean value, otherwise False.
- Switch node: It outputs either one of the two values based on the condition input from the previous node.
- Cycles Material Output node: Used for controlling Cycles material parameters, very intuitive to understand I bet.
Basic setup for driving by selected scene:
- Mostly the same as above.