How can I use outputs of nodes for other materials?

Let’s say I have a color node in one material and want to use the output in another Material.
Cube A is color x so I have a RGB node putting out x.
Cube B’s material should use cube A’s color and modify it in a certain way.
So if I change A’s color B should also alter the modified color dynamically.
Hope this makes sense.
Thanks for any advice and a Happy New Year.

Only way I can think of is to use non-exposed RGB in a node group. Let’s say A is bright red and B is dark red. I’d drop the RGB into a node group with no inputs and two outputs; original bright color in first output and the color going through a modification node to the second output. If I now change the RGB within the node group to green, the second output will have a modified version of green.


Let me explain in other words:

Can I put my color (or any parameter) x in a kind of ‘global variable’ that I can read in another material to use and process it there?

Yes, but you’ll need to use the Text Editor and some Python scripting. You can pull data from nodes, store it, and use it elsewhere- you’ll just have to do that in code.

Great! So the python variables are global in the whole scenery.
Shouldn’t be too difficult to define and retrieve some variables, I’ll give it a try!

Check out this thread

Can materials share same centralized base color?

Edit: like CarlG’s answer, with node groups you can do more than just a colour value.
Edit 2: I have been playing around with the node group method.
I added a colour as a costom property to the cube and used that property to drive each chanel of an rgb node and made a node group with it.
Then I added that node group to the other objects and changed the colours of the objects with a hue sat node.
Then I added a wave texture to the node group and a few simple math nodes using the rgb value.
Now the colour of the cube changes the colours and the wave pattern of the other objects :slight_smile:
Silly but fun!


Seems to be a perfect solution for me since I need not mess around with python!
Didn’t know about the link character of node groups in a scenery.

Yes this was CarlG 's solution. I just elaborated it with the driver and custom property.
Node groups are general data and the custom property with the driver gives you an easy way to change the colour value without having to dive into the node group.
Here is the file if you want to take a look at the drivers setup.
ColourDriver.blend (920.0 KB)
You can play with the hue, saturation and value sliders of the custom property colour it is quite fun!
Edit I changed the file because I had the viewport lighting turned off.

Thanks for the link. I’ll examine ASAP.
Thanks to CarlG also.