"Global" shading- is this possible?

What I want to do is to assign materials in the usual way to objects, but then be able to process ALL of them through a global shader node setup. Is there a way to do this? Will building a node tree in the “World” shader area achieve this? I can’t find any discussion of this kind of thing.

You will want to create a group node in your shader tree and add this node to all the shaders you want to affect. A change within the group node affects all instances of the group node.

World Nodetree is only for the background if a ray hits nothing else.

Thank you.

To make sure I understand: if I apply the group node to objects, A, B, and C, and then I want to make adjustments in the group node, I can go to A, and open the node, make adjustments, and regroup, with same name- will this make the changes in B and C as well?

You can leave it in world as an unused group for easy access without having to select an object that uses it. I do this all the time with “light groups” for projects big enough to make finding lights in the outliner a hazzle. However, you can only globally adjust things inside the group that are not exposed.

@ CarlG:
I’m sorry, I’m not sure what you mean by “you can only globally adjust things inside the group that are not exposed.” Could you please clarify?

If an attribute within the group is connected to the group input, it’s value/connection will be set differently for each material the group appears in. (according to the options/connections on that material’s instance of the group)

@J_the_Ninja:

Thanks for the reply. So I would have to set up the group and apply to every object individually, and if I wanted to adjust it, I’d have to do that for every object individually as well, right?

Is there some other approach to achieving what I’m after? I’d like to be able to individually texture/shade objects as ‘stock’ items, then apply different global effects to them in different scenes.

For example, I have six characters, a room and two dozen objects, each with their own materials, etc, depending on what they are, for basically a realistic appearance. In scene one, they are rendered in a naturalistic way. In scene two, they are processed with a toon shader through a mix node with their existing materials. In scene three, the style is grainy film noir, in scene four, a hand-colored photograph. All these are mixes with the materials already attached to each individual object.

You can see why I’d rather not have to individually set up every object with a brand new node tree, I’d like to have a way to alter everything in the scene at once.

Is there some way to apply nodes to, say, collections of objects that already have individual materials assignments?

You better start learning python… :slight_smile:
Although it’s possible to use nodegroups for controlling common parts of materials, to setup them correctly in scenes with lots of objects will be hard…
I can imagine lots of problems dealing with multiple scenes… What should be copied, what should be linked, etc… Managing this by hand is not an easy task.

1 Like

I’d say your best bet is using a group node.

Build a group node (let’s call it “materialEffect”).
Inside this group put the “effect node tree” (toon shader or whatever), and let’s call it “material2”.

Connect it to a mix shader node. The output of the mix goes out of the group node.

Then connect the input coming from outside the group node (let’s call it “material1”) to the mix node, and set up the mix as you want it.

Now for every material insert the “materialEffect” at the very last point between the material and the output (“surface”).

When you need to change the setting of the mix node, you can do it just once, it will propagate to every other instance of this group.

If I am getting this right, perhaps a node group like this would work:

You feed all the data through a node group like this example with image textures, normal maps, etc.

This is then modified inside with your own material styles that you want (or even shaders if you move the shader node in there and only output the shader node output).
The output of the node group is then fed back into the material for displaying it.
All the changes you make inside the node group to stylise everything will apply for all other materials if all materials use a similar method.

Example adjustments for the textures that would apply to all materials using this node group between the image inputs and material output:


This is just to show how you can make changes that would affect everything. You can definitely go much more advanced with it.

Say I want to render out a specific set of lights in isolation. Instead of finding all the relevant lamp shaders and geometry emission shaders, I can create a simple passthrough shader with shader in and shader out that I put between emission shader and whatever comes next.
Now in world, I can add this passthrough (loose, not connected to anything) shader and control all these lights by simply disconnecting the input from the output. Because what happens inside happens to all the lamps and emission shaders that use it, I can easily turn off all these lights.
It’s not light groups, but it’s what we have.

1 Like

Thank you all so much, I think you’ve put me on the right track.

@piergi: Your explanation is very clear, thanks!

@unyxium Thank you for the screen shots! Very helpful.

@CarlG: Thanks for the clarification. That does seem very powerful.

Now to put all this into practice!