Switch node in Shader editor
The idea came from other DCC packages and renderers. Blender offers pretty decent random color variations for copied/instanced objects, although it turned out to me it is not so easy to implement switching textures with the current given nodes. Sometimes I need variations of textures across different objects and it become messy building the graph.
My proposal is to implement the special-purpose node which should have dynamic inputs for textures and one input ranged [0..1] as a switch between them. Basically, the switch criteria should be just a random object id.
As a proof of concept, I wrote simple OSL shader with this functionality and it works fine! The only drawback is that OSL isn't working with GPU in Blender.
4 Comments
That looks great! It would be nice to have a button to add more input sockets.
I made something similar a while back with a group of math nodes and mix shaders. It's not perfect, but as far as I know it works on GPU.
* @dekanuva * Yeah! Good setup! I`ve tried the same too. Although, both variants lack dynamic inputs...
I need this! <3
Damian, where is the complete code for your OSL shader? I can see just a fraction of it...