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

Chapter 4. Diving In: Your First Animati... > Creating Scene Elements for Your Pro...

Creating Scene Elements for Your Project

With your project created, start by saving the scene (File | Save Scene) and naming the file beach01. As you work through the following tutorials, you can save as often as you like. Usually, it's a good idea to save after performing several operations on an object or the scene. If you're making major changes to the scene that won't be easy to undo later, save the file with an incremented name (such as beach02).

After working on other projects, when you want to return to this saved file, choose File | Project | Set. This specifies the project you're working on and points Maya to the correct location of all resource files that are related to the project. You can also choose File | Recent Projects to select from a list of the most recent projects you have worked on, and this automatically finds the resources for the selected project.

With the project set, and your initial scene file saved, you're ready to begin modeling the scene! You'll start by creating the beach.

Tutorial: Creating the Beach

The first dstep in creating the beach is deciding which type of geometry to use. For the lumpy sandy beach, a simple NURBS plane will work well. You'll model the lumpiness using Maya's Artisan tool, and because you're using NURBS, you can avoid a faceted look.

On the DVD

Chapter_04\movies\ch04tut02.wmv


1.
First, set the Attribute Editor to appear in a floating dialog box instead of replacing the Channel Box. This makes it easier to change values in the windows and switch between the two dialog boxes. Choose Window | Settings/Preferences | Preferences, and in the dialog box that opens (with Interface selected in the left column), toggle the Open Attribute Editor and Open Tool Settings options to In Separate Window. Click the Save button to close the dialog box.

2.
Create a NURBS plane by choosing Create | NURBS Primitives | Plane | option box. In the NURBS Plane Options dialog box, reset the settings with Edit | Reset Settings. Set Width and Length to 50, and set U Patches and V Patches to 15, as shown in Figure 4.2. Click Create and name the new object Beach in the Channel Box. Press the f hotkey so that you can see the entire beach.

Figure 4.2. Using the NURBS Plane Options dialog box to change values when creating a surface.


Sculpting the Sand

Now, you'll use a Maya tool called Artisan to paint the shape of the sand.

3.
Switch to Perspective view and make it full screen. Press 5 to make this view switch to Shaded mode. Turn off the grid in this view by choosing Show | Grid from the panel menu (make sure to toggle off the check mark next to the Grid option in the menu). Press F3 to switch to Modeling mode. Make sure the Beach object is selected, and then choose Edit NURBS | Sculpt Surfaces Tool | option box. Click the Reset Tool button at the upper right of the Attribute Editor.

4.
Set the Radius [U] value to 4 to make the brush four units wide. For this tutorial, assume that a unit is about a foot. So when you brush on the beach surface, you'll push down an area about 4 feet in diameter. Sculpt Variables Max Displacement is set to 1, so in one brush stroke, the surface will be moved by 1 foot. Brush the foreground half (in the positive-Z direction, look at the axis icon at the bottom left of your Perspective viewport) of the beach to make it lower, to mimic the way a beach slopes down into the ocean. Go ahead and minimize the Sculpt Surfaces Tool dialog box if you like, but don't close it because you still need to edit some of its settings.

tip

If you have a pressure-sensitive graphics tablet (such as Wacom's Intuos and Graphire tablets), this would be a good time to use it because you'll have more control with the Sculpt Surfaces tool. In the Sculpt Surfaces Tool dialog box, click the Stroke tab. Under the Stylus Pressure section, set the pen to be sensitive to Opacity, Radius, or Both.

5.
In the Sculpt Surfaces Tool dialog box, change the operation from Push to Pull, and add some lumps to the sandy shore. Also, make the landscape rise as it recedes from the shoreline, as shown in Figure 4.3.

Figure 4.3. The finished Beach object, sculpted to look more natural.


6.
If your beach needs a little adjustment, try using the Erase and Smooth tools, next to the Push and Pull operations you've already used. The Erase function puts the beach back to its original flat state, and the Smooth function averages nearby areas to take some of the more dramatic peaks and valleys out of the beachscape.

tip

You can interactively change the Sculpt Surfaces tool's current operation, such as pushing, pulling, or smoothing, by pressing and holding the u key and clicking on the surface you're sculpting. This action opens a marking menu with options for the Artisan tool.


Tutorial: Creating the Ocean

Now, you'll create a NURBS plane that will be the ocean in your beach scene. You'll apply a different technique of modeling that allows you to animate the motion of the waves over time.

On the DVD

Chapter_04\movies\ch04tut03.wmv


1.
If you're still in Sculpt Surfaces mode, use the q hotkey to return to Select mode. Then, create a NURBS plane (Create | NURBS Primitives | Plane | option box). Set Length and Width to 100, and U Patches and V Patches to 30. Click Create and name the new object Ocean in the Channel Box.

On the DVD

Chapter_04\ch04tut02end.mb


2.
In the Channel Box, adjust the ocean plane's height and distance to make it butt against the shoreline. For a good depth, set Translate Y to –1, and set the distance (Translate Z) to 30.

3.
If you need to, you can adjust the bumps of the beach surface to make sure it fits your ocean correctly. Simply double-click the Last Selected Tool button (bottom of the Tool Box) or choose Edit NURBS | Sculpt Surfaces Tool | option box and switch the operation mode to Push or Pull to make the shoreline more uneven. Your finished ocean/beach should look similar to Figure 4.4. Then, save your scene.

Figure 4.4. The finished ocean and beach with a wavy shoreline.


Tutorial: Modeling the Fish

Now, you'll build a fish by starting from a NURBS sphere, which will be edited into a classic fish shape. Then, you'll add details such as the eyes by using NURBS spheres and fins by using NURBS cones.

On the DVD

Chapter_04\movies\ch04tut04.wmv


1.
Open the Create NURBS Sphere Options dialog box (Create | NURBS Primitives | NURBS Sphere | option box). Be sure to reset all values to their default by choosing Edit | Reset Settings from the dialog box menu. Next, choose Display | Hide | Hide Unselected Objects so that you can focus on the newly created sphere. Use the hotkey Shift+F to center the sphere in all four views. Rename the sphere Fish01 in the Channel Box, set Rotate X to 90, and then set Scale X to 0.5, Scale Y to 2, and Scale Z to 1.4. In the Channel Box, open the INPUTS - makeNurbSphere1 section, and set Spans to 12. This gives you some extra lines to move around to shape the fish.

On the DVD

Chapter_04\ch04tut03end.mb


2.
Tap the spacebar with the mouse over the Side view to change it to full screen. Right-click and hold over the fish wireframe to open the Component marking menu, and drag right over the word Hull so that you can edit the sphere's hulls. Now, when you click any of the vertical purple lines, the entire ring around the fish is selected, so editing becomes easier.

3.
To fashion a mouth opening for the fish, select one of the vertical lines. The entire vertical row should be surrounded with yellow dots indicating the control vertices for this hull. Then, press the left and right arrow keys to select other vertical rows. This is called pick-walking in Maya, and it's a handy way of making quick and precise selections. Pick-walk to the leftmost points of the sphere, which are actually a group of tightly spaced points. Be sure to go all the way to the end because hulls at either end of the sphere tend to be close to each other. Switch to Move mode (hotkey: w), and the transform manipulator appears at the center of the selection. Click and hold over the blue arrow and then drag to the right until the CV is almost to the center of the sphere. By dragging only the blue arrow, your movement is constrained to the Z-axis.

4.
Pick-walk to the next ring of CVs with the left arrow key. Drag this ring of CVs to the right, about halfway to the center of the sphere (see Figure 4.5). Switch to Scale mode (hotkey: r), and scale the ring to half its height in the up and down axis.

Figure 4.5. Moving a ring of CVs to sculpt the fish's mouth.


5.
Pick-walk with the left arrow key to the next ring of CVs (now the leftmost ring). Use the scale manipulator to compress the ring in the up and down axis to about the same vertical height as the last ring—this step forms a mouth.

6.
Pick-walk to the next ring of CVs and use the Move and Scale modes to position and size this ring just to the right of and slightly larger than the preceding ring (see Figure 4.6).

Figure 4.6. Adjusting the third ring of CVs.


7.
Pick-walk to the next ring of CVs with the left arrow key. Use the Move and Scale modes so that this ring is a similar size as the last ring and about 0.2 units to the right to make the corners of the mouth.

8.
Continue adjusting the position and scale of all the rings to match Figure 4.7. Note that the two rightmost rings for the tail have been scaled down vertically and shifted slightly to the left to start forming the indentation of the back fins.

Figure 4.7. Roughing out the fish's body.


9.
Now, you'll work with the fish in CV mode: Right-click over the fish's wireframe and choose Control Vertex. To finish the mouth, select the three purple vertices along the centerline, at the leftmost side of the fish (see Figure 4.8). Switch to Move mode and drag these CVs to the right by about 0.6 units.

Figure 4.8. Selecting CVs that control the corners of the mouth shape.


10.
Tap the spacebar over the panel to return to Four View mode, and you can examine the fish in the Perspective view. Notice that the rear fin area seems too wide, so you need to taper it. The taper should begin before the two rings that form the waist (the beginning of the tail section). Select this ring of CVs in the Side view by dragging a marquee around the ring just to the left of the tail (see Figure 4.9). Then, switch to the Top view and make it full frame.

Figure 4.9. Selecting the first set of CVs to scale in the X-axis to make the beginning of the tail section thinner.


11.
Taper the tail inward by scaling the CVs for each row in the X-axis. You can marquee-select each row and then scale it in the X-axis (horizontal for the Top view) to the profile shown in Figure 4.10. Remember to use the arrow keys so that you can pick-walk groups of NURBS CVs just as you do with NURBS hulls.

Figure 4.10. Scale the CVs in the Top view to sculpt the fish's tail.


12.
Switch back to the Side view and marquee-select the two CVs at the top of the tail. Move them down near the next CVs. Repeat for the bottom two CVs, as shown in Figure 4.11. You can continue to shape the tail by moving and scaling groups of CVs. Press F8 two times to return to Object mode; the fish object returns to a display mode of green lines.

Figure 4.11. Move the tail CVs closer to the centerline to reduce the tail size.


13.
Now, you'll make the eyes. Open the Create NURBS Sphere Options dialog box (Create | NURBS Primitives | NURBS Sphere | option box), and choose Edit | Reset Settings. In the Channel Box, set the Scale values to 0.2, Rotate X to 90, and Rotate Z to –90. Then, open the INPUTS section and set End Sweep to 180. Now, you can position the sphere where the eye would go (above and behind the mouth). Use the Side, Perspective, and Front views to position the eye with the Move tool. Name the sphere eye_left01. Duplicate the eye (hotkey: Ctrl+d), rename the duplicate as eye_right01, and set its Rotate Z value to 90. Then, move the eye into place on the other side of the body.

14.
Now, you'll create a top fin. Open the NURBS Cone Options dialog box (Create | NURBS Primitives | NURBS Cone | option box), and choose Edit | Reset Settings. Position the cone near the top of the fish. In the Channel Box, set Scale X to 0.1 and Spans to 3 in the INPUTS section. Rename the fin as FinDorsal01.

tip

Remember that you can change the NURBS display's level of detail by selecting the object and pressing 1, 2, or 3.

15.
With the cone object still selected, press F8. Now you can select rows of CVs and move, rotate, and scale them to form the fin. You can use Figure 4.12 as a guide. Press F8 to exit Component mode when the fin is shaped the way you like it.

Figure 4.12. Rotate the cone's CVs to help shape the fin.


16.
Duplicate the dorsal fin (hotkey: Ctrl+d). Rename the duplicate as FinVentral01, and change Rotate Z to 180. Now, you can position the fin at the bottom of the fish. Next, scale the fin in the up and down axis to about 80% of the dorsal fin's height. You might also want to return to CV Edit mode and tweak the ventral fin's shape. Exit Component mode with F8.

17.
Duplicate the ventral fin (hotkey: Ctrl+d) to create the pectoral fin. Scale the new fin uniformly to about 50% of the ventral fin's size. In the Channel Box, rename the fin as FinPectoralL01 and change Rotate Z to 240. Then, position the fin on the side of the fish, as shown in Figure 4.13. Make sure the end of the fin is embedded in the side of the fish so that its open edge doesn't show.

Figure 4.13. The completed fish object.


18.
Duplicate the pectoral fin (hotkey: Ctrl+d). Set its Rotate Z to 120, and its Translate X to the negative value of the same amount. Using the negative value flips the fin to the other side. Rename the fin as FinPectoralR01. See Figure 4.13 for the finished fish.

19.
Zoom your views out (hotkey: a) so that you can see the entire fish. Then, select all the parts of the fish by dragging a marquee around them. Now, group these parts into a single item (hotkey: Ctrl+g). In the Channel Box, rename the fish from group1 to FishG01. Unhide the items you hid at the beginning of this tutorial (Display | Show | All).

20.
Now that you can see the landscape and water, it's clear the fish is too big and not in the water. Make sure you have the FishG01 group still selected, and place it in the water. (Translate Y and Z values of about –3 and 15 should put your fish underwater but above the ocean floor.) If you have deselected the group, you can reselect it by selecting one part of the fish and pressing the up arrow. Set all the Scale values to 0.2 to make the fish group the correct size.

tip

If you select DorsalFin01 in one of the viewports, the other components of the FishG01 group wouldn't be selected. However, you can click any component of the group and press the up arrow to easily select the entire group. Grouping the objects creates an upper-level “group node” that bundles all the objects together. You can also use the arrow keys to navigate to other hierarchically arranged objects in the Outliner. For example, in the Outliner, expand FishG01, select any fin, and press the left and right arrow keys. You'll see the highlighted selection move to other parts of the FishG01 group. The left and right arrow keys let you move to siblings of the selected object; the up arrow takes you to the parent, and the down arrow takes you to a child.


Tutorial: Adding Materials

Now that you've built your fish, water, and beach, you'll create some basic surfaces for the scene. Because realistic surfaces require creating textures that are too complex for the nature of this chapter, you'll make some basic materials for practice, and then import the more complex materials afterward.

On the DVD

Chapter_04\movies\ch04tut05.wmv


1.
Open Maya's material creator with Window | Rendering Editors | Hypershade. Make sure the Create Bar is on (toggled with the checkered button at the far left in Hypershade) and set to Create Materials mode (right-click on the Create Bar to change its mode).

On the DVD

Chapter_04\ch04tut04end.mb


2.
MMB-drag the Blinn material type from the Create Bar to the bottom tab of the Work Area in the Hypershade window. Double-click the newly prepared material to open the Attribute Editor. Rename the material as water, and set the color to sea blue (click the color swatch to open the Color Chooser, and set the HSV values to 180, 0.5, 0.5). Set Transparency to 50. Close the Attribute Editor. Now, MMB-drag the water material from the Hypershade Work Area onto the ocean plane in the shaded Perspective view. It should immediately switch to a semitransparent look (see Figure 4.14).

Figure 4.14. The applied water material is immediately evident in the shaded Perspective view.


note

You learn more about working with Hypershade to create textures and surfaces in Chapter 9, “Materials.”

3.
Repeat step 2, but make the color tan (HSV values in the Color Chooser: 40, 0.4, 0.8) and name it sand. Under the Specular Shading section in the Attribute Editor, set Reflectivity to 0 because you won't be seeing reflections in the sand. Set Eccentricity and Specular Roll Off to 0.5 and 0.3 to create softer highlights. Close the Attribute Editor and return to Hypershade. MMB-drag and drop the new material from the Work Area to the beach.

4.
Now, you'll create a test material for the fish. First, select the fish by opening the Outliner (Window | Outliner), and clicking on the FishG01 item. Activate the Perspective view and press f to fill the viewport with the fish object. Choose View | Look at Selection from the panel menu to center and focus on the fish. Press 6 to enable hardware texturing in this panel.

5.
MMB-drag a Blinn material to Hypershade's Work Area, and then double-click the material to open the Attribute Editor for the new material. Set the color slider to the far left to create a black color, and name the material fisheye. In the Specular Shading section of the Attribute Editor, set Eccentricity to 0.25 and Specular Rolloff to 1 for a shiny look. To make the highlight whiter, drag the Specular Color slider to the far right. Close the Attribute Editor.

6.
Now, Shift-select the fish's two eyes in the shaded Perspective view. Right-click on the fisheye material in the Work Area, and choose Assign Material to Selected. The fish's eyes turn shiny black to indicate that the material has been assigned.

7.
Now, you'll explore how to make a more complex material by creating a new material for the fish body. As before, MMB-drag a Blinn material to the Work Area, and double-click it to open the Attribute Editor. Rename the material as fishbody in the Attribute Editor.

8.
Select the fish body (named fish01) in the Perspective view. Return to Hyper-shade, right-click on the new fishbody material, and choose Assign Material to Selected.

9.
Double-click on the fishbody material in the Work Area to return to the Attribute Editor, and then click the checkered icon to the right of the color slider. This overrides the solid color with more advanced texture mapping options. A selection panel appears with a mix of texturing options. Choose the one called Ramp, under 2D Textures. The red/green/blue gradient should appear on the fish in the shaded Perspective view.

10.
In the Attribute Editor under Ramp Attributes, select U Ramp in the Type drop-down list, and the gradient stripes become vertical. Now, you can experiment with different gradients for the fishbody material. Stripes are created by putting gradient markers close to one another. If you enable hardware texturing (hotkey: 6) in a view, you can see the gradient projected onto the fish, as shown in Figure 4.15.

Figure 4.15. You can adjust the gradient and see the results in real time in a shaded view if you enable hardware texturing.


11.
Test your results by clicking the Render button (the director's clapboard icon at the upper right of the Maya interface) when the Perspective view is active. Orbit around the fish and render it from different sides.

On the DVD

Chapter_04\fishbody.ma


12.
Now, you'll import some completed materials and assign them. In Hypershade, choose File | Import and then browse to the fishbody.ma file on the DVD. Click the Import button, and the new fishbody material should appear in the top tabs of Hypershade. You might need to pan or zoom the top tabs and confirm that they're set to the Materials tab.

trap

To have the textures loaded correctly, you must have the DVD in the drive.

13.
You can assign this material to the fish body. Select the fish body, right-click over the fish-body material in Hypershade, and choose Assign Material to Selection. You should see the orange-and-white striped material appear on the fish, provided you have hardware texturing enabled in the shaded Perspective view.

On the DVD

Chapter_04\fishfin.ma


On the DVD

Chapter_04\water.ma


14.
Now is a good time to import the rest of the advanced textures for your scene by repeating steps 12 and 13 for the fish fins, the water, and the sand. Import the files noted next to the DVD icons: fishfin.ma, water.ma, and sand.ma.

On the DVD

Chapter_04\sand.ma


Tutorial: Creating Lights, Camera, and Environment

Up to now, you have used default lighting for rendering—a simple lighting scheme with no shadows. Now, you'll create lights for the scene. You'll also create a camera and build an environment.

On the DVD

Chapter_04\movies\ch04tut06.wmv


1.
First, create the sunlight for your scene by choosing Create | Lights | Directional Light. In the Channel Box, rename the light as sun, and set its Rotate Y and Rotate Z to 60. Change the Scale settings to 15 so that the icon is easier to see and select (changes in Scale values don't change the effect of a Directional light).

On the DVD

Chapter_04\ch04tut05end.mb


2.
Open the Attribute Editor (hotkey: Ctrl+a), and lower the Intensity setting to 0.5. Next, you can enable shadow casting: In the Shadows section, click the Use Depth Map Shadows check box, and set Dmap Resolution to 2048 so that the shadows have more detail. Also, set Dmap Filter Size to 3 to soften the shadow edges. Set Shadow Color (just above the Depth Map Shadow attributes) to about 20 so that the shadows aren't absolute black. This setting helps add more depth to your renders.

3.
If you render a shot from under the water, the fish won't cast a shadow because the water plane is casting an opaque shadow. To fix this, you need to set the water plane to not cast shadows. Select the water plane object, and in the Attribute Editor, look for the OceanShape tab. Expand the Render Stats section and deselect the Cast Shadows check box.

Now, you'll add a light to create those illuminated patterns you see under water, known as caustics. You'll do this by using a light as a projector to shine the effect in the shore area underwater.

4.
Create a Spot light (Create | Lights | Spot Light). In the Channel Box, name this light caustics. Set Translate X, Y, and Z to 0, 71, and 35, and set Rotate X to –90. These settings make the Spot light point straight down in the water near the shoreline. The Spot light might be out of the viewable area, but you should be able to zoom out in the Front or Side view to relocate it.

5.
Open the Attribute Editor (hotkey: Ctrl+a). Lower the light Intensity setting to 0.8. Set Penumbra Angle to –8 so that the light fades out gradually. Next, click the checkered icon next to the light's color swatch so that you can pick a texture to act as a slide for this light to project. Select Water from the 2D Textures list. Now, the settings for the water material will appear in the Attribute Editor. Under Water Attributes, set Wave Amplitude to 0.5. Under Color Balance, click the Color Gain swatch and set it to light blue (HSV: 180, 0.5, 1.0).

6.
Click the place2dTexture tab at the top of the Attribute Editor. Here, you can adjust how this texture is mapped. Set Repeat UV to 10 for both entries. This makes the texture repeat 10 times to create more wavelets across the beach that this Spot light shines on. You can render a shot of the fish with the current lighting to see its effect. It should look similar to Figure 4.16.

Figure 4.16. This underwater rendering shows the simulated caustics created by the projector light.


7.
Add a camera to the scene that's the designated point of view. Use Create | Cameras | Camera. In the Perspective panel, choose Panels | Look Through Selected. The panel switches to the new camera view. In the Channel Box, set Translate Y to 9, Translate Z to 45, and Rotate X to –5. This should give you a broad view of the scene.

8.
Open the Attribute Editor for this camera. (You can reselect the camera and activate the Attribute Editor in one step by choosing View | Camera Attribute Editor for the camera1 panel.) In the Environment section, click the Create button next to the Image Plane label. The Attribute Editor switches to a new item labeled imagePlane1.

9.
In the Type drop-down list, change the setting from Image File to Texture. Now, click the checkered button to the right of the Texture entry to open the Add Render Node dialog box. In the Environment Textures section, click Env Sky. This adds a procedural sun/sky image behind the rendered elements for this camera. It's linked to the camera, so the sky appears correctly, regardless of camera orientation or animation.

10.
Set Total Brightness to 1.9, Sun Brightness to 0.6 (use color settings of 180, 0.6, 0.0), Elevation to 60, Azimuth to 135, Sun Size to 5, and Blur to 3. Now, render a test image from the camera view, and you can see the background sky, as shown in Figure 4.17.

Figure 4.17. The background of any rendered view from the camera now shows a sky effect.


Tutorial: Animating the Fish

Now, you'll add some animation to the scene. The fish needs to bend back and forth while traveling along a path to make it look like it's swimming through the water.

On the DVD

Chapter_04\movies\ch04tut07.wmv


1.
First, you'll set the animation length to 600 frames to give you a 20-second animation. Do this by typing 600 into the Playback End Time text box (just to the right of the Range Slider). This “pushes” the total animation length out to 600 frames.

On the DVD

Chapter_04\ch04tut06end.mb


2.
Select the FishG01 node in the Outliner (Window | Outliner). If you select by clicking on a part of the fish, you'll select one part of the overall FishG01 group. Press the up arrow key to select the group, in this case. In the Side view, press f to fill the panel with the selected item. The entire fish should appear with a green wireframe to indicate selection.

note

You'll learn more about working with animation settings in Chapter 11, “Animation Basics.”

3.
Now, you'll assign a bend deformer to the fish. First, make sure you're in Animation mode (hotkey: F2). With the group selected, choose Hotbox | Deform | Create Nonlinear | Bend | option box. Reset the settings and then create a deformer. The bend handle is then selected, and you can set its Rotate X to 90 in the Channel Box.

4.
In the Channel Box, click the bend1 rollout for the bend1Handle. Set Curvature to 2 and you can observe the effect. (Switch the camera view back to Perspective view to get a closer look at the effect, as shown in Figure 4.18.) The eyes aren't bending with the head as you'd expect. An easy fix is to set the High Bound value to 0.1; then, the bend occurs primarily in the tail area.

Figure 4.18. Applying a bend deformer to the fish allows you to control its swimming motion.


5.
Now, you'll add some animation keys for the fish: Set the Time Slider to frame 1. Set Curvature to a value of 0. Then right-click over the word Curvature and choose Key Selected.

6.
Set similar keys at frames 12 and 24.

7.
Go to frame 6, set Curvature to 2, and set a new keyframe.

8.
Go to frame 18, set Curvature to –2, and set a new keyframe.

9.
If you click Play at this point, the fish swims once and stops, but you can fix this in the Graph Editor.

10.
Open the Graph Editor (Window | Animation Editors | Graph Editor), and make sure the bend1Handle is still selected. Press f with the Graph Editor active, and the animation keys for the fish zoom to fill the window.

11.
Marquee-select all five points on the curve, and then choose Curves | Post Infinity | Cycle from the Graph Editor menu (see Figure 4.19). The fish then makes the swim motion in an endless loop. You can play back the animation to see this.

Figure 4.19. By setting all the keys to cycle post-infinity, the fish bends back and forth forever, regardless of the length of the animation.


12.
Now you need to connect the bend deformer to the fish so that they stay together if the fish moves. To do this, select the bend deformer handle, and then Shift-select a part of the fish. Press the up arrow to select the entire fish group, and then press p to parent.

13.
Switch to the Top view and press the up arrow to select the entire fish group, which now includes the bend deformer.

Now, you'll duplicate the fish with the animation so that you can create an entire school of fish.

14.
Choose Edit | Duplicate | option box, and reset the settings. Then select the Duplicate Input Graph check box and click the Duplicate button. In the Top view, move the new duplicate to the left of the original fish.

15.
Duplicate the fish three more times (hotkey: Ctrl+d), moving each one to the left. You should have a total of five fish.

If you play back the animation, you'll see that all the fish move together in lock step, so you need to vary their motion to make it more random.

16.
Select the bend deformer for FishG02 (the first duplicate you made). It's easy to select if you scrub the Time Slider to a frame where the fish is bent; the bend deformer has a straight line that extends from the end of the fish. If you closed the Graph Editor, reopen it and press f to fill the window with the animation curve for this bend deformer. Now, switch to Scale mode (hotkey: r) and MMB-drag right and left. You should see the curve scale widen (see Figure 4.20). Scale the animation curve's width about 50% wider than the original to make the fish swim slower.

Figure 4.20. MMB-dragging in Scale mode in the Graph Editor causes the curve to expand and contract interactively.


17.
Because the fish swims slower now, it makes sense to scale it slightly larger. To do that, select one of its fins, press the up arrow to select the entire fish, and then scale the fish about 150% larger.

18.
Repeat steps 16 and 17 to make all the fishes different sizes, and scale their motions by varying amounts to have them swim at correspondingly different rates.

You have the fishes wiggling, so the next step is making them move through the water. Also, adding some camera motion would make the scene more interesting, as would having the light intensity change when the camera emerges from the water. You also need the water to have some waves to finish off the look of the ocean scene.

19.
Switch to the Top view, select the ocean, and hide it (hotkey: Ctrl+h). Choose Create | CV Curve Tool and draw a curvy line from the right side of the beach to the left. Note that you'll have to place four points before the line begins to appear onscreen. Press Enter when you're done, and name the line fishpath01 in the Channel Box. Press F8 to enter CV Edit mode. In the shaded Perspective view, you can raise or lower the CVs to alter the path's height. You want to adjust the path so that it stays between the water and the ocean floor. It can't get too close to either object because the fish shouldn't skid along the ocean floor or have a fin showing above the water line.

20.
With the motion path in place, you can attach one of the fish to this path: Select the FishG01 group, Shift-select the fish path, and then choose Animate | Motion Paths | Attach to Motion Path. If you play back the animation, the fish seems to be moving sideways. To fix this, select the fish path, and in the Channel Box, click the OUTPUTS section under motionPath1. Change the Up Twist setting from 0 to 90, and the fish should move correctly, as shown in Figure 4.21. You can experiment with the other Twist settings, too.

Figure 4.21. One fish is now on a motion path.


21.
Repeat steps 19 and 20 to create motion paths for the other four fish. The fish should swim as a school, so the other paths should be similar to the first, but slightly different and not intersecting.

note

You can continue to edit the swim paths after you've set the fish to follow the path. This allows you to adjust for any collisions with the water top, the sand floor, or other fish.

22.
Unhide the ocean (hotkey: Ctrl+Shift+H).

Tutorial: Animating the Camera and Water

Now that the fish are swimming, it's time to make the camera and water move, too.

On the DVD

Chapter_04\movies\ch04tut08.wmv


1.
Switch the Perspective view to the camera view if you haven't already (Panels | Perspective | Camera). Make sure the Time Slider is rewound to the start. In the Top view, select and move the camera to one side of the fish, facing toward the beach. Rotate the camera so that the fish are swimming toward it. For this tutorial scene, the starting camera position is set to Translate X, Y, and Z of 16, -3, 26 and Rotate Y of -50.

On the DVD

Chapter_04\ch04tut07end.mb


2.
With the camera still selected, switch to Move mode and press s to set a key. Next, switch to Rotate mode and set a key.

3.
Go to frame 120 and repeat step 2. Again, try to position the camera so that the fish are near, but don't have the camera rotate too much from its previous rotational orientation. The settings used for this tutorial are Translate X, Y, and Z at 14, -3, and 23 and Rotate Y at –9.

4.
Go to frame 240 and repeat step 2. (Your values should be around Translate X, Y, and Z at 4.5, -3.5, and 21 and Rotate Y at –9.)

5.
Go to frame 360 and repeat step 2, with Translate X, Y, and Z set to around -5, -2, and 15, Rotate Y to –13, and Rotate Z to –9. The Z-rotation anticipates the lifting motion of the next keyframed movement.

6.
Go to frame 480 and repeat step 2, but this time the camera is rising out of the ocean and moving inland. Your values should be around Translate X, Y, and Z at –8, 3, and 13, Rotate X at –13, and Rotate Y at –9.

7.
Go to frame 600 and repeat step 6. Your values should be roughly Translate X, Y, and Z at –10, 5.5, and 7, and Rotate X, Y, and Z at –20, -31, and 6.

8.
Preview the animation from the camera view. Adjust one of the six keys if the camera is hitting anything or looking in the wrong direction. If you need to fine-tune the camera's position or rotation between keys, use settings of 60, 180, 300, 420, or 540. Be sure to set a key for any changes you make to rotation or position, and be sure you're at the correct frame number before setting a key. Smooth motion is most easily achieved with a smaller number of keys.

Next, you need to find the frame where the camera crests the water, and set a key before and after this frame for the sunlight. This ensures that the water looks a bit moody and dark, but the beach scene is well lit.

9.
Scrub the Time Slider while looking at the shaded camera view to find the approximate point where the camera rises above the water. Use the single-frame forward and backward controls to find the exact frame. In this tutorial's animation, frame 388 was underwater, and frame 389 was above water. These values are used in the next step, but yours might be a few frames before or after, so use your frame numbers instead.

10.
Set the current frame to the frame that's your last underwater frame. Open the Outliner and select the Directional light named sun. In the Channel Box, right-click over the Intensity label, and choose Key Selected. The field should remain at 0.5, but turn orange to indicate that a key exists.

11.
Go one frame forward. Adjust the Intensity value to 1.0. Then, right-click over the Intensity label and choose Key Selected. Now, you can scrub the Time Slider to confirm that Intensity jumps from 0.5 to 1.0 at this frame.

Next, you'll make the water undulate by using soft body dynamics.

note

To learn more about soft body dynamics, see Chapter 15, “Particle Systems and Dynamics.”

12.
Switch to Dynamics mode (hotkey: F4), select the ocean object, and choose Soft/Rigid Bodies | Create Soft Body | option box. Change the Creation Options to Duplicate, Make Original Soft. Select the Hide Non-Soft Object and the Make Non-Soft a Goal check boxes. Click Create, and you'll notice a lot of little green dots appearing around the ocean. These dots are the particles that make the soft body system work.

13.
Open the Outliner, and expand the ocean object by clicking the + next to it. Then, click on the oceanParticle object you just created. All the particles are now selected. Change Goal Weight [0] from 0.5 to 0.2. This amount controls how closely the rippling ocean wants to return to the flat, original ocean object.

note

When you select oceanParticle, notice that the information in the Channel Box changes. That's because the Channel Box is displaying all the particle attributes that can be modified by default. You can also display these properties by opening the Attribute Editor (hotkey: Ctrl+a) and clicking the oceanParticleShape tab.

14.
With the oceanParticle object still selected, choose Fields | Turbulence. Change Magnitude to 6 and Attenuation to 0, and play back the animation. If the waves are too large, you can decrease the Magnitude setting, and vice versa.

If your animation plays back slowly or choppily, you might need to change the animation playback speed, or your computer might not be powerful enough to play the animation smoothly. Click the Animation Preferences button to the right of the Range Slider or choose Window | Settings/Preferences | Preferences to open the Preferences dialog box. In the Categories list, scroll down to Settings, and click the Timeline entry (see Figure 4.22). Under the Playback section, select Play Every Frame in the Playback Speed drop-down list, and then click the Save button to save these preferences. These changes should have the animation playing more smoothly.

Figure 4.22. Changing the playback setting in the Preferences dialog box.


tip

If your animation still plays back very slowly, you can playblast the scene (Window | Playblast | option box). Playblasting takes a copy of each frame from your viewport and plays it back in your default media player or the FCheck utility. It's an accurate method for testing the playback speed of your animation.


note

Remember to set the Time Slider back to zero for your scene if you've been playing an animation. The leftmost playback button (double left arrows) is the quick button to do this. Don't forget to stop playback first! Some dynamic geometrical deformations, such as in the water, remain unless you “rewind.”


Tutorial: Underwater Plants with Paint Effects

In this tutorial, you'll use Paint Effects to add foliage to the beach and some other elements to the underwater areas.

On the DVD

Chapter_04\movies\ch04tut09.wmv


1.
Switch to Perspective view and toggle it to full-screen, shaded mode. Open the Visor with Window | General Editors | Visor (hotkey: Alt+v).

On the DVD

Chapter_04\ch04tut08end.mb


2.
Make sure you're in Render mode (hotkey: F5), select the Beach object, Choose Hotbox | Paint Effects | Make Paintable to designate the beach as the surface Paint Effects will paint on. In the Visor, click the Paint Effects tab. Expand the Trees folder, and click on the palm.mel brush. Now, you can draw a stroke across the back of the Beach object (see Figure 4.23).

Figure 4.23. Drawing the first line of palm trees at the rear of the beach.


3.
Now, open the Attribute Editor for this brush stroke. Switch to the palm1 tab. You'll change a number of values for the palm trees, starting with their size and density. You might have noticed the palm tree is small and only one tree is evident. Set Global Scale, near the top, to 25 to increase the tree size. Expand the Tubes section, and then the Creation section. Set Tubes per Step to 0.3, and you'll notice more trees appearing.

4.
These trees are a bit dark by default. To change their colors, in the Shading section, set the Color 1 swatch to a lighter brown (HSV: 22, .65, .55). Then, set Incand1 to a dark brown (HSV: 30, .4, .16).

5.
Now, expand the Tube Shading section. Set the Color 2 color swatch to a greenish hue (HSV: 94, .28, .2). Set the Incand2 color swatch to a color of 120, .5, .07.

6.
In the Shadow Effects section, select the Cast Shadows check box so that the trees cast shadows on the beach. You might have noticed that the trees seem to be laying down. To correct this, expand the Behavior section and then the Forces section. Change the Gravity setting to 0.1. Next, expand the Turbulence section, and select Tree Wind in the Turbulence Type drop-down list to make the trees look like they're being affected by a warm ocean wind.

7.
You can use these settings for your next paint stroke by choosing Paint Effects | Get Settings from Selected Stroke. Now you can make several more strokes to fill the island with trees. Try rendering a shot of the Perspective view to evaluate what the scene looks like. You might want to adjust the perspective camera to have a white background; remember that only the camera you added will have the Sky Environment attached. To make the perspective camera render with a white background, choose View | Camera Attribute Editor, and expand the Environment section. Drag the background color slider all the way to the right to get a white color. Your scene and rendering should look similar to Figure 4.24. Be sure to let the animation play for at least five frames so that the dynamics can perform its magic and set the waves in motion.

Figure 4.24. A test render after all the tree strokes are drawn.


8.
Now, return to the Visor and open the Grasses folder. Select grassBermuda.mel and paint some foliage on the beach. For a little more depth, select the jungleGrass.mel brush next to finish off your landscaping.

9.
Continuing in the same vein, you can paint in the underwater scene as well. Look for the Underwater folder in the Visor, where you'll find seaweed, shells, starfish, and other elements you can paint directly on the ocean floor. You might need to reduce their Global Scale setting before painting with them. Be careful to put them far enough away from the camera and fish to avoid collisions. Also, some Paint Effects don't look good at close range, so you might need to keep some brush strokes back some distance from the camera.

Tutorial: Rendering Settings

All of your hard work finally comes together when you render your scene. During rendering, Maya calculates each frame in your scene and saves it as a file. You then sequence those files together to play the animation in FCheck (Maya's image viewing program) or your favorite compositing program. You can continue from the previous tutorial, or load the scene file noted next to the DVD icon. Before you render the scene, however, you need to change some of the rendering settings, explained in the following steps.

On the DVD

Chapter_04\movies\ch04tut10.wmv


1.
Open the Render View window (Hotbox | Window | Rendering Editors | Render View), and then open the Render Global Settings window (Options | Render Globals on the menu), which contains the settings for your render. First, make sure Maya Software is selected in the Render Using list box. To specify a name for the images that will be rendered, under Image File Output, enter BeachFly in the File Name Prefix text box, and select name.#.ext in the Frame/Animation Ext list box as the naming convention for files created during a batch render. For example, frame 67 would be named BeachFly.067.tif.

On the DVD

Chapter_04\ch04tut09end.mb


2.
To specify the number of frames to be rendered, enter 600 in the End Frames text box. Next, change Frame Padding to 3 (for three digits) to have preceding zeros added for numbers below 100. This ensures that the numbering system works for all image compilation programs.

3.
You need to choose an image format. You'll use the AVI movie format to get something you can easily watch when the rendering is finished. (Refer to Chapter 1, “Pre-Maya: A Primer,” for information on different file formats.) Most important, be sure to select the correct camera for rendering: In the Camera list box, select Camera1. Deselect the Alpha Channel (Mask) check box because you won't need it in this render. Next, switch to the Maya Software tab, and under the Anti-Aliasing Quality section, select the Production Quality mode. Then, under Raytracing Quality, select the Raytracing check box. Finally, select the Motion Blur check box and select the 2D radio button for Motion Blur Type (see Figure 4.25). After you've made these changes, close the Render Global Settings window.

Figure 4.25. Using the Render Global Settings window to specify settings for a batch render.


4.
Save your scene.

5.
If you'd like some single-frame test renderings, you can use the Render View window; just click the Render button. If the wrong view is rendered, right-click with your mouse cursor placed over the image, and choose Render | Render | View (for the view you want to render).

6.
To render the animation, click Hotbox | Render | Batch Render. If you have a dual-processor machine and won't need both processors, use the option box to enable rendering with all processors. Maya then begins the render, and the movie will be stored in your Project directory in the Images folder. You can watch the progress of your render by opening the Script Editor (Window | General Editors | Script Editor).

Viewing Your Render

In this example, you've rendered a movie file rather than a frame sequence. Now that you've waited for all the frames to render, you'll want to see it played back. To do this, simply double-click the saved movie or start Windows Media Player and load the newly rendered AVI.

In some cases, you might want to render to a frame sequence rather than an AVI. For example, if an AVI rendering is interrupted by a power failure, the entire movie rendered to that point is likely to be corrupt and unplayable. Sometimes, you'll want to render to a series of sequentially numbered TGA, TIFF, or IFF frames; however, your operating system doesn't easily handle viewing movies that are frame sequences. This is where FCheck comes into play. This utility is Maya's animation viewer. It allows you to load a sequence of images you have rendered and play them in order.

When you install Maya, shortcuts to the FCheck utility are placed in your Start menu. Go to the Start menu and then the menu item where Maya is located. Click the FCheck shortcut to open the utility. Open your animation by choosing File | Open Animation on FCheck's menu bar, browse to the Images folder in your Project directory, and select the first image file, BeachFly.001.tif. Click the Open button, and then watch as the animation is loaded into memory. FCheck loads the entire sequence and then plays it back at full speed.

For maximum compatibility between platforms, the AVI file for this chapter's project has been converted to WMV format (with Microsoft's free WMV conversion utility) and added to the DVD (see the file noted next to the DVD icon), so you can view the intended result of this chapter, if you like.

On the DVD

Chapter_04\ch04beach.wmv


Going Further

To enhance the scene you've built in this chapter, you might want to try adding other dynamics fields, such as Air (for a wind effect) or Vortex (a whirlpool!), and play the animation to see the results. Also, you can achieve some interesting results by tweaking just a few settings in the Turbulence field. Try modifying values for the Frequency, Attenuation, and Magnitude settings.


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