What’s up everyone? Matt again, with the Maya Learning Channel.
Question: Have you ever looked for help on Maya only to be told to
“connect this node to that” or “check the graph?”
Then be shown a picture of something like this… or this… or even this?
I mean, what the heck is this supposed to be anyway!?
Well, the good news is that you aren't crazy –
the graph IS a real thing and it IS actually very useful.
But to explain it, I’ll need to take you on a journey down into the deep, dark recesses
of Maya’s inner-workings.
Just kidding!
Well, actually half kidding. While we will be taking a closer look at the way Maya works
under the hood, what’s there isn’t nearly as dark and mysterious as you might think.
It all starts up here, in the Node Editor.
Now I know this can seem like one of Maya’s more intimidating editors,
but it’s really not so bad once you understand a simple fact:
Maya scenes are nothing more than visual representations of something called
a node graph.
Every object you create in Maya is represented by a node.
Actually, more often than not, one object is actually made up of a bunch of them!
Think of these as an object’s DNA. And just like DNA,
an object’s “node graph” determines things like its shape, color,
and other physical characteristics.
To see what I mean, let's create a basic cylinder in my scene.
Notice that my one cylinder is actually made up of 4 nodes.
These are its Shape node, a utility helper, a shader, and a transform.
The Shape node is pretty self-explanatory: it determines the overall shape of the cylinder
by storing the position of all its vertices.
But individual vertices can be a pain to work with,
which is why this polyCylinder node is attached to it.
This is what’s called a Utility node, and if I look in the Attribute Editor
you can see how it contains all these useful controls like Radius, Height, and subdivisions.
By the way, these tabs up here in the Attribute Editor?
They just show you the nodes associated with a selected object.
But getting back to this utility node,
notice that the right-side of the helper feeds into the left side of the Shape node.
This just means that the utility node spits out values – like radius, height, or subdivisions
that the shape then uses to help place its vertices.
Strictly speaking, this helper isn’t even necessary.
Notice that if I delete it, the cylinder still remains a cylinder.
But then we lose all those nice, easy-to-use inputs feeding it.
So after the helper node feeds values to the shape,
you’ll see the shape feeds values to a shading group.
As you’d imagine, this determines the object’s color.
The vertex data being sent to it tells the shader all about the shape it's coloring.
Finally, you’ll notice this last node off by itself, not attached to the others.
This is the Transform node, and its job is to specify where the object exists in the scene.
So anytime you select an object in Object Mode and then move, rotate, or scale it,
this is the node you’re actually altering. This includes moving its pivot around too.
But the question remains, why isn’t it connected to the others?
Well, the answer is actually over here in the Outliner, if I just turn on Display > Shapes.
Now you can see that while they aren’t connected in the graph,
they are still related in the parenting hierarchy.
Think of it like this: Maya uses the node graph to determine what the object should look like –
again, the DNA of the object –
and then all of that is stuffed into a Transform node (sort of like a body)
that then puts it somewhere in the scene.
More than anything else, this is the key to understanding how Maya works
– so if you’re going to take away anything from this video, make sure it’s that.
Whether I create a different polygon, like a cone, or a NURBS curve, or a light,
you’ll see this same pattern over and over again: shape + transform = object.
Also, notice how both my cylinder and cone both feed into the same initialShadingGroup
that's applied to all polygon objects by default.
Sure enough, I can tweak this one shader and both objects change color in the Viewport.
Meanwhile, NURBS curves and lights don’t have shaders, so they're not connected.
Now if I apply a different shader to each of the objects, notice how the graph changes.
A new node and connection have been added,
so that each object is connected to its own shader.
That means I can tweak each of them individually.
In short, every action you perform in the UI, adds to or alters the graph in some way.
But the reverse is true too! I can make changes directly in the graph
that will affect my scene.
The simplest example is if I just connect two transforms together – say, rotations.
So I'll just drag from one to another...
And now the cylinder’s rotation values will drive the cone’s as well!
If I wanted to, I could even join just one axis of rotation instead,
leaving the other two free to do whatever.
For a slightly more complex example,
watch what happens if I select both objects and then choose Mesh > Combine.
Whoa, suddenly there’s a lot to unpack here… or is there?
Let me break it down so it’s not so bad.
First off, these polyCone and polyCylinder utility and transform nodes haven’t changed,
so we can effectively ignore them.
The most interesting new addition is this “polyUnite” node.
As you might’ve guessed, this is the utility node that actually merges the two shapes together.
If I follow its connections backwards,
I find my original cone and cylinder shapes feeding into it,
which makes sense given I used them as inputs.
This results in this new object, which has the default name pCylinder2.
For clarity though, let’s just change that to more sensible “pCombined”.
Now I can see in my Node Editor that this new object even has its own shape and transform –
which, as I’ve hammered on again and again, is necessary for every object to have.
And if I rearrange things a bit, you'll see the shape even feeds into not one
but BOTH shaders, since its combined faces consist of both colors.
In general, graphs become a lot simpler if you just look at them a few connections at a time.
Lastly, we have these two extra transform nodes.
If I check the Outliner, you can see that they’re parented under my original cone and cylinder.
These record the state of these shapes at the time I combined them,
which makes this the perfect opportunity to talk about an object’s history.
You see, as you continue to add different modifiers onto an object –
combines, deformers, extractions, and so on –
this string of nodes will continue to grow longer and longer.
The advantage of this is that, at any point, I can trace the path back to see how I arrived at
a specific shape, or even make alterations to the past
without having to undo all the steps between!
For example, I can still change the relative position of the cone
by adjusting its Transform...
Or use the cone's helper utility to flare it out a bit more, turning this into an arrow.
All without ever having to separate my pCombined object.
On the flip side though, long strings of nodes can also pollute your Node Editor,
making it almost impossible to read.
They can also take up a lot of memory and slow down your scenes.
So once you've finalized an object,
and are absolutely sure you don’t want to make any more changes,
it's generally good practice to select it, then go up to Edit > Delete by Type > History.
This removes the selected object’s history,
simplifying it back to its Transform and Shape.
Now my arrow is no more complicated than any of the basic primitives.
Also note that some operations, like the Toolbox Transform tools,
work directly on the vertices in the Shape node without recording any history.
To make all tools work like that, you can turn off Construction History in the Status Line.
Lastly, you can also create nodes right in the graph, without using the main UI.
To do so, I can either click up here to open the Create Node pane...
Or I can press Tab in the workspace and just type a node’s name if I already know it.
For an example of how I might use this,
let's go back to the Create Node pane and create a “Multiply Divide” node.
This'll let me do some basic math.
Then I’ll duplicate my arrow.
To quickly re-organize these nodes into something more sensible, I can select them,
along with the multiplyDivide node, and click the "Show Inputs and Outputs" button up here.
This button will display everything connected to your current selection, and is SUPER useful.
Now, much like we did earlier, I’m going to connect the rotation of these two arrows,
via their Transform nodes.
However, rather than connect them directly, let me first run it through Input 1 of this utility.
Notice if I select the arrow now, the multiplyDivide node has been added
to the list of tabs in the Attribute Editor since they’re connected.
Also, Input 1 changes to always match the arrow's rotation.
Next, I’ll set Input 2's Z value to 12...
...and set the Operation to Divide.
Now I’ll take the output of that and feed it into the second arrow's rotation,
so it rotates at 1/12th the rate.
And last but not least, I'll scale down my second arrow.
And voila, now I've got a clock!
Of course, this is a fairly silly (albeit cute!) example of the graph at work,
but it does contain all the elements you need to understand the building blocks of Maya.
For more practical examples, check out my comprehensive rigging tutorials,
where I use utility nodes to create IK and FK controls for appendages…
...or my Render Setup series, where I show you how to override Shape and Transform values.
Or, just try experimenting on some of your own scenes and watch how the graph changes.