About Texture-Mapping NURBS Surfaces


All surfaces in Maya have texture coordinates, called UVs, that show Maya how to place a 2D image on a 3D model (Figure 14.38).

Figure 14.38. On the left are the UV coordinates of a NURBS sphere. On the right are those of a poly sphere.


A NURBS surface is always four-sided. Even a sphere is four-sidedit's pinched at the top and bottom, and the other two sides meet. In a plane, the U direction extends from left to right, and the V direction extends from bottom to top. This makes the lower-left corner the start point (Figure 14.39).

Figure 14.39. On this plane, the CVs are visible, and you can easily see the U and V directions. The square at lower left is the start point; the U is to the right of it, and the V is above it. This means that the U direction goes from left to right, and the V direction runs from bottom to top.


Any image you bring in is also four-sided because image files are square or rectangular. The lower-left corner of the image is placed at the start point of the surface. The bottom of the image is mapped on the surface along the U direction, and the left side of the image is wrapped along the V direction (Figure 14.40).

Figure 14.40. The same image is assigned to different NURBS surfaces. It gets wrapped around the surface, and its orientation depends on the U and V directions of the surface.


Because all NURBs are four sided, they must be distorted and pinched in order to match the shapes you specify, like the top of a sphere or cone. This means that textures assigned directly to the surface are distorted the same way. To avoid this distortion, NURBS surfaces are often textured using projections. (In addition, most NURBS objects consist of many separate NURBS surfaces.)

Mapping an image or texture to the color attribute lets you put detailed surfaces on your objects. Any attribute with a Map icon next to it can be mapped ot a texture, and any attribute with the connection iconnext to it is already mapped to something. Some attributes, like bump mapping, must have a map linked in order to function.

NURBS surfaces' UV coordinates are built in. To shade your NURBS surface, you need to place your textures properly. We'll discuss shading polygonal objects later in this chapter.

To map an image to the color of an object:

1.

Choose Create > NURBS Primitives > Plane.

2.

Open the Hypershade, and click Lambert to create a new material.

A new lambert material appears in the Hypershade.

3.

Double-click the lambert you just created in the Hypershade.

The Attribute Editor for the lambert opens.

4.

Click the Map icon to the right of the Color slider (Figure 14.41).

Figure 14.41. By clicking the Map icon (the little checkerboard to the right of the slider), you can map a texture to the color.


The Create Render Node window opens.

5.

Make sure the Normal radio button is selected, and then click File (Figure 14.42).

Figure 14.42. In the Create Render Node window, you can choose which new texture you want to map to an attribute of a material.


The Attribute Editor for the File node opens.

6.

Click the Browse button next to Image Name.

7.

Browse for and open your own image file.

Maya creates two new nodes (file1 and place2dTexture1) and links them to your lambert material (Figure 14.43).

Figure 14.43. New nodes are created and placed in the workspace. The colored lines indicate connections from one node to another.


8.

With the middle mouse button, drag the lambert you created from the Hypershade onto your surface.

9.

Click in the Perspective view, and press to switch to textured mode.

The image you chose is now color-mapped to your surface (Figure 14.44).

Figure 14.44. An image is mapped to the color of the plane.


Tips

  • You can also map an image to any of the common material attributes by using the process in the previous task.

  • You can map any existing file node to an attribute by dragging it with the middle mouse button onto a material in the Work Area and selecting color (or any other option).

  • If your color image has an alpha channel, the areas the alpha channel masks out are transparent.

  • You can also map an image by dragging an existing texture onto the name of an attribute in a material's Attribute Editor (Figure 14.45).

    Figure 14.45. The file texture in the Hypershade is being dragged with the middle mouse button to the color in the Attribute Editor of a material. This provides a quick and convenient way to make connections.

  • You can find your textures more quickly if you place them in the source images folder of your project directory. Maya defaults to this directory whenever you use an Open dialog box to assign an image file.


Bump maps need to be mapped in order to function. They work from the value of an image, so they're commonly black and white.

To assign a bump map to a surface:

1.

Choose Create > NURBS Primitives > Plane.

2.

Open the Hypershade, and create a lambert.

3.

Assign the lambert to the plane by using the middle mouse button to drag it from the Hypershade to the plane.

4.

Double-click the lambert in the Hypershade.

The Attribute Editor for the lambert appears.

5.

Click the Map button next to Bump Mapping .

The Create Render Node window appears.

6.

Click Bulge (Figure 14.46).

Figure 14.46. Clicking Bulge in the Create Render Node window creates a bulge texture that is mapped to the bump of a material.


The bulge shows up in the Work Area. You need to render it to see the resulting bump.

7.

Frame the plane in your Perspective view, and click the IPR Render button .

Once you render, the bulges appear on the surface (Figure 14.47).

Figure 14.47. This is a rendered image of a plane with a bulge texture mapped to its bump. Render to see the bumpit doesn't show up in the Perspective view.


8.

In the Work Area, double-click the bump2d node. It may help to click Rearrange Graph to find the node.

The Attribute Editor for the bump2d node appears.

9.

Change the bump depth by moving the slider or typing in a number (Figure 14.48).

Figure 14.48. The Attribute Editor for the bump2d node contains the bump depth attribute. Bump depth controls the overall height of the bump.


The bulges grow or shrink accordingly (Figure 14.49).

Figure 14.49. The plane on the left has a bump depth of 1; the plane on the right has a bump depth of 0.5.


Tips

  • Bumps are best used when defining small details, so you should use depth values that range between 1 and -1. Setting the values to extremes can cause the illusion to break down.

  • Bump maps (and other value-based maps) work best if they take full advantage of the 255 shades of gray available in an image. Image-editing software like Adobe Photoshop can help increase the contrast and range of your source images before you apply them, which reduces your reliance on the Bump Depth slider.


When you first map an image on a NURBS surface, it may not be oriented correctly. You can use the place2dTexture node to rotate, move, and scale the texture. You can also use the place2dTexture node for tiling and adjusting coverage.

To use place2dTexture:

1.

Create a lambert, and then map a bulge to the color channel.

2.

Double-click the place2dTexture node on the left side of the Work Area.

The Attribute Editor for the place2dTexture node appears.

3.

Click the Interactive Placement button. A red square with a dot in the middle appears on the surface (Figure 14.50).

Figure 14.50. The red square indicates the position, rotation, and relative scale of the texture.


4.

Drag with the middle mouse button, starting from the center point of the interactive placement icon on the object's surface.

The texture moves on the surface (Figure 14.51).

Figure 14.51. The position of the texture is moved via interactive placement. The bulges are now offset so that they don't evenly cover the surface.


5.

With the middle mouse button, drag at the corners of the red square. The texture rotates (Figure 14.52).

Figure 14.52. The interactive placement was used to rotate the bulge texture.


6.

Click in the field next to Repeat UV, type 1, and press .

The bulges now cover the same distance but with only one bulge, making them longer in the U direction (Figure 14.53).

Figure 14.53. The bulges now cover the surface, repeating only once in the U direction. A higher number in the Repeat UV field would result in more numerous, narrower bulges.


7.

In the field two columns to the right of Repeat UV, type 1; press.

There is now a single bulge on the surface (Figure 14.54).

Figure 14.54. With only one repetition, the surface has just one bulge.


Procedural textures

The bulge texture you just used is an example of a procedural texture. Procedural textures are images that have their color and value determined mathematically. This means they're easier to place and have infinite resolution.

Procedural textures are used to generate simple surfaces like rubber or concrete, add detail such as dirt or bumps to existing surfaces, make realistic metallic surfaces, and more. One commonly used procedural texture is a ramp, which is like a gradient.

To assign a ramp texture to a surface:

1.

Choose Create > NURBS Primitives > Sphere.

2.

In the Channel Box, type 90 in the field next to Rotate X, and press .

3.

Open the Hypershade, and click Phong E.

A phong e material shows up in the Work Area.

4.

Double-click the phong e material in the Hypershade.

The Attribute Editor for the phong e material appears.

5.

Click the Map button next to the Color slider .

The Create Render Node window opens.

6.

Click the Ramp button (Figure 14.55).

Figure 14.55. When you click Ramp in the Create Render Node window, a new ramp texture is created and mapped to a material.


The Attribute Editor for the ramp appears. A ramp texture node also appears in the Hypershade.

7.

With the middle mouse button, drag the phong e from the Hypershade onto the sphere to assign the shader.

If you have trouble finding the phong e material, click the Work Area and press to frame all the nodes.

8.

Click the Perspective view, and press to see the texture (Figure 14.56).

Figure 14.56. A ramp texture is a gradient between one or more inputs. The default is an eye-catching linear RGB gradient, shown here.


To make the ramp texture look like an eyeball:

1.

Create a material with a ramp texture, and assign it to a sphere as in the previous task.

2.

Open the Hypershade, and, in the Work Area, double-click the ramp texture.

The Attribute Editor for the ramp appears.

3.

In the Attribute Editor for the ramp, change the type to U Ramp.

4.

Click and drag the top position indicator down slightly (Figure 14.57).

Figure 14.57. The Attribute Editor for the ramp holds the controls for determining the look of the gradient it produces. Position indicators are the circles to the left of the ramp. They determine where a color is positioned within the gradient.


5.

Change the position indicator's color to black by dragging the Selected Color slider all the way to the left.

6.

Click and drag the middle position indicator, which is green by default, to just below the top one.

7.

Click the ramp about one-fifth of the way down from the top.

A new position indicator appears (Figure 14.58).

Figure 14.58. When you click in the middle of the ramp, a new position indicator is created. By clicking the square with the X in it to the right of the ramp, you can delete a position indicator.


8.

Click and drag the bottom position indicator up to just below the new one.

9.

With the bottom position indicator still selected, click the color swatch next to Selected Color.

The Color Chooser opens.

10.

Click the white swatch at the top of the Color Chooser (Figure 14.59).

Figure 14.59. The white swatch is selected in the Color Chooser, causing the selected position indicator and the ramp below it to become white.


The sphere is now textured like an eyeball (Figure 14.60).

Figure 14.60. The eyeball is complete with a pupil and iris.





Maya 7 for Windows and Macintosh(c) Visual Quickstart Guide
Maya 7 for Windows & Macintosh
ISBN: 0321348990
EAN: 2147483647
Year: 2006
Pages: 185

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net