As you add nodes to your model, your node graphs gets larger. The Grouper node helps you organize your graph and increase modularity for reusability of components.
There are two ways to use Grouper to organize you nodes: 1. Combination and 2. Encapsulation..
Simple Mesh Combination
Perhaps the simplest way to group nodes is to feed there out put into a Grouper’s mesh inputs. For simple graphs, this is a fast and easy way to work with multiple objects as one pieces.
For example, if we make a box with two Extrudes that share the same Rectangle Shape from the Library, we can easily manipulate both the base of the box and the sides by modifying the height and width of the Rectangle.
But what if we now want to repeat this box in a line? We have two separate meshes that make up the box. Before repeating lets combine these meshes with the Grouper Inputs.
Make sure that none of the nodes are currently selected (click anywhere on the node graph background) and then select a Grouper node from the righthand sidebar in the Node Graph Editor and connect the output of the two extrudes to the Grouper.
Now the Grouper Output Mesh can be fed into any other node as a single unit.
For example, click on the Grouper Output and then click on LinearRepeater in the righthand sidebar.
Now the combined meshes are repeated as a unity. If you stamp out the model, the bottom and sides are still separate GameObjects. If you would like to truly combine the meshes (perhaps to reduce draw calls or have them function as a unity as rigidbodies, you can click the Combine Meshes option under the Grouper Output.
The benefits of this form of Grouping is that it is fast and you can see all the nodes at once. However, as your graph gets more complex, seeing all the nodes at once can be too messy. Also, this method does not allow for true encapsulation of logical parts that can improve reusability of subsystems in other models. The next use of Grouper is improves these factors.
You can also encapsulate nodes inside the Grouper by dragging them over the Grouper’s thumbnail. Nodes inside the Grouper form a subgraph that can be reused in multiple models.
In this example, we have a section of wall with a window. The main control is the Rectangle of the window opening.
The graph that powers this is looking a little complicated. In this case it would be getting cumbersome to connect all these mesh output to the inputs of the Grouper.
If we drag all the nodes over its thumbnail, then we have created a subgraph that encapsulates all the nodes. Now we have a single node that hides all of its complexity.
By double-clicking the Grouper thumbnail, we can go inside the Grouper and continue to operate on its parameters, and relations.
To step back out of the Grouper, we can double click its thumbnail again or click else where in the “breadcrumb trail” at the top of the node graph window.
As with the Mesh Combination method, we now have a single mesh output that we can feed into other nodes, such as a RadialRepeater.
To adjust parameters of nodes inside the Grouper, we can open it, but that would break the concept of encapsulation we are trying to achieve. What would be better is to create proxy parameters in the Controls of the Grouper to define its parametric behavior. This essentially creates an interface to the subgraph so that we need not ever go down into the subgraph and be distracted by its details.
In this case, the interface might be the width and height of the wall and the width and height of the window opening.
For the opening, lets create window width and height parameters.
For the wall lets use the default SizeX and SizeY of the Grouper.
Lets open the Grouper (perhaps one last time!) to connect theses parameters:
Now that we have encapsulated the wall section model and provided an interface, we have hidden the complexity of the subgraph to allow us to think at a higher level as we continue to use this parametric wall section in other larger assemblies.
If you do find yourself going back into the Grouper to adjust parameters, then it may be a good idea to make proxy parameters in the Grouper for them. In other words, once you finish rigging up a subnode graph in a Grouper, you should never need to open it again.
Also, keep in mind that you can have Groupers inside Groupers, to further organize and encapsulate.
Also note, that a Material given to a Grouper will be inherited by its Groupers in the subnode graph unless overridden inside.