| Theme

Maya Connections
by Jamie McCarter

Maya Connections
by Jamie McCarter

Start Maya.

One of the great strengths of Maya is it's flowchart network of nodes and the ability to connect attributes from node to node. A fairly simple idea, but in execution very powerful. A vast majority of my time rigging characters is spent in the hypergraph making connections (expressions pay a large role as well, though that will have to wait until a future tutorial). In this tutorial I'll be touching on the hypergraph and the strength of connections.

A spider web of connections that comprises just a small bit of a larger character rig. Our network won't look anywhere near so complicated. No worries.

Lets begin by supposing we want to create a sphere that rests on the origin and as the sphere increases in size, it remains resting on the origin. OK, perhaps not the most flash tutorial, but it'll get you familiar with making connections between seemingly unrelated attributes. And then we'll move onto some cooler stuff.


Ensure that construction history is enabled.

Create a nurbs plane (Create > NURBS Primitive > Plane) and a nurbs sphere (Create > NURBS Primitive > Sphere). Unfortunately, our plane is bisecting the sphere. We'd prefer the sphere to rest on the plane. We could simply translate the sphere up in Y and have done with it. However we've also stated that we want the sphere to always remain resting on the ground plane as it changes in size. In order to achieve this we'd have to simultaneously adjust the translateY and the radius of the makeSphere node. And if we were animating the sphere we'd have to ensure the animation curves for both the radius and the translateY were identical. Sounds fairly arduous to me.

This is where the connectivity of the hypergraph comes in handy. Two solutions to our problem are readily apparent. We can either key translateY and then use the same animation curve to drive the radius of the sphere. Or we can drive the radius of the sphere with the translateY.

I much prefer the idea of connecting the translateY of the sphere to the radius of the makeSphere node. This will give us the ability to interactively move the sphere and see the sphere increase in size. If we were to connect the animation curve of translateY, first we'd have to have the translate keyed, and secondly when we went to position the sphere we wouldn't see the sphere increase until after keying.

So lets connect the translateY to the radius!

Open the Connection Editor (Window > General Editors > Connection Editors). Now select the nurbs sphere and click the "Reload" button on the "Outputs" side of the connection editor. In the channel box click under the "INPUTS" section where the "makeNurbsSphere" node is. This doesn't actually select the node, but for windows such as the connection editor, it's enough of a selection. Click "Reload" on the "Inputs" side.

You'll notice that both the makeNurbsSphere and the nurbs sphere transform are loaded. We'll just ignore the latter and focus on the makeNurbsSphere node.

Open up the Translate section on the "Outputs" side and select "translateY". Now select "radius" on the "Inputs" side. If you don't have "Auto-Connect" activated you may need to click the "Make" button. But typically the connection should be made for you automatically.

First thing you'll notice is that the sphere disappears. No worries. This is simply because we have directly connected the translateY of the sphere to it's radius. And as the sphere is sitting at the origin, the translateY is 0. Consequently so is the radius. Select the sphere in the outliner, move it up and down and you'll see the sphere appear and adjust in size.


So what is going on here? As the diagram below illustrates, the translateY of the sphere flows from the transform node to the makeNurbsSphere. Thus continuously updating the radius to be equal to the translateY. And the makeNurbsSphere outputs the sphere data to our shape node, creating a fabulous re-sizing sphere. Hazzah!

But, you may say, "Why didn't we just move the pivot of the sphere to the base of the sphere? Then when we scaled the sphere it would scale about the point resting on the ground plane." Quite true. And perhaps that would be a solution, but if you then attempt to rotate your sphere, it would rotate about the pivot resting on the ground and not the center of the sphere. Depends what effect you are going for. With Maya there is usually at least two ways of arriving at the same location.  



Alright, so that achieved lets do a bit of shading on our sphere. It's going to get a bit more complicated now, so hang on. The effect I'd like is one of polished glass with the appearance of lighting casting through the volume and reflecting off the back surface. And, as I've got a slow computer and a tight deadline I'd like to use only one light source and no raytracing.

Windows > View Arrangement > Two Panes Stacked. In the upper pane make sure it's the persp view. (Panel > Perspective > persp) and smooth shading is on (Shading > Smooth Shade All). In the bottom pane, the hypergraph (Panel > Panels > Hypergraph).

Bring up the create render node window (Rendering > Create Render Node...) and ensure "With Shading Group" is activated. Now click Surface Shader. In the hypergraph appears a surfaceShader node connected into a shading engine. Select the surfaceShader (probably named surfaceShader1) and middle-click drag it over the sphere in the persp window. Release. The sphere now turns a horrible green. Ahh well. That's the default openGL shading appearance of the surfaceShader.  It will render somewhat differently.


Create a point lightsource (Create > Lights > Point Light) and place it above and slightly to the right of our sphere. Now we're almost ready to render.

Before we begin rendering, lets change out background colour to something other than black so that we can easily see the sphere. View > Camera Attribute Editor brings up the persp attributes. Open the "Environment" tab and set the "Background Color" to a colour of your choosing. I chose Red 0.161, Green 0.333, Blue 0.510 to match this website. You might want to choose a neutral grey.

Now change the persp panel to a render view (Panel > Panels > Render View). And render an interactive render (IPR > IPR Render > persp). The sphere appears, but black and uninteresting. No worries. Click drag a render region around the sphere. IPR will now update these pixels while we modify our shading network.

We're going to need some more rendering nodes. Create an anisotropic shader (without a Shading Group), an rgbToHsv utility node and a ramp texture (without New Texture Placement and as "Normal" - not projection or stencil).

Connect the ramp's .outColor to the surfaceShader's .outColor. You can do it through the connection editor if you like. However if you middle-click drag the ramp over the surfaceShader node it should connect automatically. Certain default connections work this simply. In the render view you'll see our surface textured with the ramp. Sweet.


By default the anisotropic shader comes in with a color of 0.5, 0.5, 0.5. Pull that down to black. Also take Diffuse down to 0.0. We're going to use the anisotropic shader just for it's specular highlight and don't need these. Now middle-click drag the anisotropic node to the rgbToHsv node. The connection editor should appear with the two objects loaded. Connect .outColor from the anisotropic node to the .inRGB attribute of the rgbToHsv. This takes the anisotropic highlight computed in the anisotropic node and by passing it through the rgbToHsv we convert the colour to separate components of Hue, Saturation and Value. We're interested only in Value in this tutorial.

Connect the .outHsvV to your ramp's .vCoord. Voila! Instead of taking the UV coordinates from the surface we're now driving the coordinates of the ramp with the intensity of the anisotropic highlight. Change the colours to better suit your mood. Notice how you can have a nice white highlight and tone it down to a blue with a very subtle purple at the dark depths. Very nice.

Alright, now that you're getting up to speed I'll leave the rest of the tutorial up to you. The shading on the left of my sphere was done with a samplerInfo node piped into both a multiplyDivide and an animation curve. Those both then piped into a diffuse shader. I'll give you a hint: play around with what happens if you multiply normals...

Good luck!


Very cool
Maya seems like it's very, very powerful. I would never be able to figure this out on my own, and I could follow this tutorial.

Out of curiosity, that first picture of that complex character rig, what is that from? :)

Re: Very cool
That character? Ummm... nothing. Something? Never you mind. ;)
Re: Re: Very cool
Wow, that's nuts. And I have fun in 3DSMax lol.

Actually it's funny.. I went into college thinking I'll come out and pursue a career in 3D animation. I come out of college loving 2D, web design and 2D animation, film etc even more than I did before.

It's a shame that the media makes 3D look so easy to do. I think it undermines the appreciation people should have for the sheer amount of work and skill that goes into VFX & CGI these days.
Re: whre are the pixelkings of the ancient world?
I dont't think it is question of doing things the hard or easy way. I think that using Poser is almost as bad a plagiarism.
Re: Re: Very cool
uuuuuhhhhh this stuff is cool!!!!!
A note for those of us using maya 4.5
I thought I would just point out that you have to turn the hypergraph into "input and output connections" mode.

This is done by clicking on one of the icons in the hypergraph panel (right after the view stacking bit in the tute). The default mode that maya starts in is scene hierarchy mode.

cheers :)
is good