• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 12. Node-Based Architecture > Connecting Attributes Between Nodes

Connecting Attributes Between Nodes

The task of directly connecting objects that contain attributes and process data can easily be thought of as a form of visual programming. Creating a dependency graph to achieve a certain goal or to solve a particular problem, all from scratch, can be very fun and an interesting learning experience. Now that we have thoroughly discussed many aspects of DAG nodes, DG nodes, and history, let's make a simple connection between a couple of nodes to establish this idea.

Exercise 12.1 Connecting Two DAG Nodes

Let's start with a utility node called a Sampler Info node and the default shader. A Sampler Info node is a really useful node for Maya's rendering engine that outputs helpful surface-shading data on a per-shading sample basis (during a render). Alias|Wavefront's definition this node is that it:

Provides you with information about each point on a surface as it is being “sampled,” or calculated, for rendering purposes. Sampler Info can give you information about a point's position in space, its orientation and tangency, and its location relative to the camera.

We will use the Hypershade and the Connection Editor to make a simple connection between these two DG nodes.

Create a sphere by clicking Create, Nurbs Primitives, Sphere.

Create a Sampler Info utility node from the Hypershade by clicking Create, General Utilities, Sampler Info (see Figure 12.7).

Figure 12.7. The Hypershade contains access to many important nodes.

Now, with your Sampler Info node currently selected, hold down the Shift key and add-select (Shift+click) the Lambert default shading group.

Still from inside the Hypershade, click the Input and Output Connections button (the little button with two arrows), as shown on the upper-left side of Figure 12.8.

Figure 12.8. The Input and Output Connections button.

Next, with the Shift button held down, use your middle mouse button to Shift-drag the Sampler Info node directly onto the Lambert default shading group. This action opens the Connection Editor window and automatically loads the nodes that you are trying to connect. You can also access the Connection Editor by going to Window, General Editors, Connection Editor.

Now that the Connection Editor is open, it is time to connect two attributes. As a simple introduction to a very useful node, you will connect the Sampler Info Facing Ratio attribute on the left side, to control the Color G attribute of the shader on the right side.

Click the Facing Ratio attribute so that it is currently highlighted. Next, expand the Color attribute on the right side of the Connection Editor window by clicking the little plus icon next to its name (see Figure 12.9). Now make a direct connection by simply clicking the Color G attribute.

Figure 12.9. The Color attribute of the Connection Editor window expanded.

You should now see your shader change color. It should be green near the interior and should have a radiated violet around the edges. This color change is the result of the “facing ratio” data controlling the Green channel of color. The facing ratio attribute outputs a value between 0 and 1, based on the angle between two vectors, the surface normal on the geometry at the point being shading, and the direction in which the currently rendering camera is pointing.

Now do a render and see the results. Try experimenting a little with connecting the Facing Ratio attribute to other attributes on the shader. A completed example node network is included on the CD in the file FACING_RATIO_SHADER.mb.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint