Drive value based on currently rendering Layer or Scene
Something lacking in Blender is the ability to render the same model with different materials in a convenient way. This is admittedly not something people commonly do in standard workflows, but part of the reason for that is the difficulty. Since the improvements to BVH speed, it is now easy to use extra render layers for material based masks and the like, which are then used in the compositor. Currently, it requires a lot of setup of new Scenes, or duplicating models onto different render layers and configuring new materials.
What would be convenient is if we could drive a value in a material based on the currently rendering layer. Then you could have multiple shader/texture stacks inside the same material, but mix between them depending on layer.
5 Comments
What would the UI look like for choosing which materials get used where? Should there be a render slot drop-down in Material Properties?
Please think this through as much as possible and, if you can, provide a mock-up image that clearly describes how you best think this feature would work in Blender.
No UI change required. All it needs is an RNA data path with a value, which then could be used to drive a mix node.
So you want to switch between multiple node trees within the same material? I'm not sure I'm a fan of that idea as it's not particularly obvious. Also, it overloads a material. Say, for instance, you want to use a wood look on one Render Layer and a slate look on another. It really makes the most sense to use two completely separate materials for that... not nestle two completely different trees into a single material. Sure, you could probably get around this a bit with node groups, but that's still a bit of a kludge.
I really think that this needs it's own UI.
In my specific use case, I am using extra render layers to render out various masks for use in the compositor. I'm using an ubershader group, which lets me conveniently configure my material in one place, so doing my mask settings there is also nice. Currently I render the main layer, then manually change a value inside the material group to switch to masks, then manually render the mask layer from the compositor. Having a proper UI to make this easier would be nice, but the real core functionality is having some way to access the currently rendering layer.
I certainly agree that this is not an elegant solution, but I still think it would add useful functionality that could potentially come up in a lot of places. More options are always nice, and holding back on useful options because it may not be the ideal user experience is just an arbitrary restriction (especially considering that most of blender gets pretty overloaded and kludgy if you are doing an non-standard workflow, using a bunch of addons or scripts, etc.)
But this site is a place for ideas. Why not take the time now to think of the elegant solution, rather than propose an "easy for now" kludge?