Single nodes (shaders, textures, input, or whatever) can be grouped together, and this is probably one of the best ways to organize our workflow.
Thanks to node groups, it's easy to store complex materials in ready-to-use libraries. It's possible to share or reuse them in other files, and they can also be used to build handy shader interfaces for easier tweaking of material properties.
Let's go to the Node Editor window directly:
Box-selecting two nodes
The appearance of the just created and open for editing node group inside the Node Editor window
The closed node group
The node group is still showing the two BSDF outputs (actually connected to the input sockets of the Mix Shader node), the name data block, and the fake user button (F). This last one is the same as in Blender Internal. It prevents the user count from ever becoming zero, and therefore prevents the deletion of any non-assigned material. When you save the file and/or close Blender by assigning the fake user to a non-assigned material, you are sure that it will not be deleted. This is particularly handy when you are building a material library.
NodeGroup
, to something else. I wrote BasicShader
.Editing the node group by connecting inner sockets to expose them
Color1
and Color2
in our case). To remove a socket, just click on the name in the Properties panel, and then click on the X icon in the bottom Name slot, as shown in this screenshot:Renaming and ordering the new input sockets through the Interface subpanel in the Properties side-panel
The appearance of the inner connections in the open node group and as exposed input sockets in the closed node group
Here, we get a simple interface for the BasicShader node group, and as you can see in the following screenshot, the exposed values can be tweaked. Also, the properties are driven by textures exactly as in other nodes:
The BasicShader node group put to use
Adding a Mix Shader node inside the node group and one more exposed socket
The final interface of the BasicShader node group
I think you get the picture. Basically, almost any input or output socket of the nodes wrapped inside a group can be connected to the outside of the node group to be tweaked.
The good thing about a node group is that you can make instances of that node (by pressing Shift + D). Note that when you modify the inner structure of a node group, the modifications get reflected in all the group instances, but the outer (exposed) values on the node group interface are local for each instance and can be individually tweaked.
Every newly created node group is available in both the Add menu (press Shift + A) and in the slots in the Material window of the Properties panel, under the item Group, to be added on the fly to the network.
To remove a node group, select it and press Alt + G. This will break the node envelope but keep the content intact and still connected.